Chat Bot in C# not responding to commands

So i made this Twitch Bot but it isnt working… when i do !donate it doesnt respond

http://hastebin.com/egijusewew.cs

Best bet is to set up some breakpoints and see where it’s failing (at first glance I see a few issues.)

private static string userName = "channel_botten"; will cause login failure, it should just have the username and not the channel_ prefix - that was the first thing error it ran into when I ran your code.

The other issue is either one of these two lines (depending on what you want to change):

string command = message.Split(new[] { ' ', '!' }, StringSplitOptions.None)[1];

and

case "!donate":

the command string is being set as 'donate' and not '!donate'. So you can change either one of these, but right now that switch case will never trigger.

Lastly, your code to send the IRC response/message is incorrect and will not send anything, it should be:

sendIrcMessage("PRIVMSG " + channel + " :" + message);

I made these changes on my end to your code and it worked as expected.

Also, I’d recommend using an existing IRC library if you’re not familiar with the IRC syntax to prevent those kind of errors

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.