How to make c# bot respong to ping?

How do i make it respond to pings sent by the irc server. I have tried a few things that have not worked, it always kills my connection after around 10 minutes.

Do you have any code that responds to a PRIVMSG? Just replicate that for PING instead. What is your understanding of how IRC works? Do you understand the message format? (this influences at what level detail to help you with)
If you reply to PING with PONG foobar, it should keep the connection alive.

If you have code uploaded to a repository such as github it makes it a lot easier for folks to help.

http://pastebin.com/h2qngPEe this is my irc class. If I could just get a nudge in the right direction that would be great

Yep, that is helpful. In line 54, you are receiving messages. One of those will be a PING. . You want to call your sendChatMessage("PONG :tmi.twitch.tv") whenever that happens.

The simple case to do that would be to put it in an if statement, "if message == “PING :tmi.twitch.tv”

looks like it is working, thanks for the help

So the way you told me works, but it types the responce in the twitch chat aswell, is there anyway to stop it from doing that with the way you told me

http://pastebin.com/k7XR6kZd that is my irc class

Hi,

Use sendIrcMessage instead of sendChatMessage as a PRIVMSG will send the response to chat.

Thanks that worked.

1 Like

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