Add embed character count to message builder and embeds.#1031
Conversation
|
I'm not convinced this is particularly useful. You can easily just add up the characters of every field yourself. |
|
I feel quite the contrary; I'd like to have more concise error messages other than |
|
Who the fuck is Chris |
|
LMAO checks* thanks autocorrect |
I do agree that it isn't too difficult to add up the characters yourself, but it sort of leaves the dev thinking: "Why isn't this just built in to the lib?". There's really no reason to not add it as I see it at least. (Given my code actually works, there might be a bug or 2 left to squash) |
I'm also in favor of this. Yes, it's not difficult. But adding this extra help reduces some of the workload by having to manually do this or have an extension method. |
|
This should not be done how you're doing it. Instead of adding to the count when a property is set, you should add the counts of all the properties when the character count property is accessed. I also feel like the character counts for the individual fields are unnecessary. |
So if the property returns a value larger than 6000, no error should be thrown?
They're only there to make adding up char count easier. |
|
I'd argue it's not necessary to return the counts to the user as they'd essentially have to count the characters themselves. More descriptive exceptions are a nice addition though. You never really know sure where your embed faulted. |
|
As of right now, the features in this pull request are pretty useless. If you still want to work on this, then
Please make these changes if you're still interested in working on this pr, otherwise it can be closed. |
|
I will go ahead and close it then. |
Summary
Adds a check so that the 6000 character limit on embeds is easier to track.
Details
Right now, there's no easy way to check if you've exceeded the 6000 character limit on message embeds. This should hopefully fix that issue.
Changes proposed
CharCountproperty toDiscordEmbed,DiscordEmbedField,DiscordEmbedFooter,DiscordEmbedAuthor,DiscordEmbedBuilder,EmbedAuthor, andEmbedFooter.EmbedsCharCountproperty toDiscordMessageBuilder.DiscordEmbedBuilder's andDiscordMessageBuilder's property. If the number is exceeded, anArgumentExceptionwill throw.