Fix Issue with Help Command in Community-Discord-BOT
October 11, 2018#### Repository https://github.com/discord-bot-tutorial/Community-Discord-BOT Pull Request : https://github.com/discord-bot-tutorial/Community-Discord-BOT/pull/130 #### Project Info A community-driven public Discord-BOT using C# and Discord .NET. The goal of this project is to create a solid general-purpose bot that can be easily extended and used in new and interesting ways. #### Bug Fixes ###### Issue? The help command of the bot was not checking the size of the embed. When the size reaches 6000 characters an exception is thrown and no help is sent as shown below https://github.com/discord-bot-tutorial/Community-Discord-BOT/issues/81 ![](https://cdn.steemitimages.com/DQmPzZ6Q7AGN41LZfGshd8bQKwJUHS8sqgmuNiYA21iYWT7/image.png) ###### Solution? After checking the code, all the help messages is adding as an Embed Field and when we are building the message the length of the message is going over 6000. At first I have taken a deep copy of the Embed Fields `var fields = builder.Fields.ToList();` Now checking if the embed length is over 6000. If it is more than 6000 removing the initial 10 fields from the embed. After removing fields again checking the length, if it is more just decreasing the initial count by 1 so that this time I will take one less than the previous one. So when I am sending the message I am sending it for the first 10 fields only and the next message is sent for the remaining field. ![](https://cdn.steemitimages.com/DQmV1FJbV4NJyrPtCJrTQQvJYJjeGwDkQ91aEipbEcqSbX6/image.png) #### GitHub Account https://github.com/codingdefined