FIX: Failed to call hook 'OnDiscordGuildMessageCreated' on plugin 'DiscordStatus v4.0.1' (IndexOutOfRangeException)Solved

i have seen that a solution has been posted here again and again. but it has been formatted incorrectly.
incorrect copy pasting can have fatal consequences.

Replace the following

line 184 - 205

            if (message.Content[0] == config.Prefix[0])
            {

                string cmd;
                try
                {
                    cmd = message.Content.Split(' ')[0].ToLower();
                    if (string.IsNullOrEmpty(cmd.Trim()))
                        cmd = message.Content.Trim().ToLower();
                }
                catch
                {
                    cmd = message.Content.Trim().ToLower();
                }

                cmd = cmd.Remove(0, 1);

                cmd = cmd.Trim();
                cmd = cmd.ToLower();

                DiscordCMD(cmd, message);
            }​


 with

            if (!string.IsNullOrEmpty(message.Content) && message.Content[0] == config.Prefix[0])
            {

                string cmd;
                try
                {
                    cmd = message.Content.Split(' ')[0].ToLower();
                    if (string.IsNullOrEmpty(cmd.Trim()))
                        cmd = message.Content.Trim().ToLower();
                }
                catch
                {
                    cmd = message.Content.Trim().ToLower();
                }

                cmd = cmd.Remove(0, 1);

                cmd = cmd.Trim();
                cmd = cmd.ToLower();

                DiscordCMD(cmd, message);
            }
        }

I hope that helps some people here without the .cs being broken!

Regards

Please give some Feedback! This helps others!

You have an extra } at the end there that makes it format incorrectly.

gimmilfactory

You have an extra } at the end there that makes it format incorrectly.

You are right, ty. Copy + Paste ;)

Will be used for fix

Locked automatically