tags:

views:

271

answers:

1

Hi

I have followed the tutorial on the Haskell wiki about implementing an IRC bot. and everything worked out fine. But once I started extending it, I realised that It would need to respond to CTCP requests from other users for commands like version and ping. These commands work for the server but not for the bot.

I read the rfc's for CTCP and for IRC clients but they are not very useful. I did the following, but I don't think it is the required message:

write "PRIVMSG" (sender++"\001VERSION Haskellbot : v1.0 : GHCi\001")

This only asked for version information from the sender. So how do I go about implementing the return message for CTCP requests and other CTCP requests in general?

+1  A: 

Upon closer inspection of the CTCP rfc, I solved it with:

write "NOTICE" (sender++"\001VERSION Haskellbot : v1.0 : GHCi\001")
Jonno_FTW
I guess you're supposed to mark this answer "accepted"?
MatrixFrog
@MatrixFrog: you have to wait at least 2 days to accept your own answer
Jonno_FTW
Note also that it's a protocol violation to automatically respond to a PRIVMSG with another PRIVMSG (and to automatically respond to a NOTICE at all) - these rules are designed to prevent infinite response loops between clients.
caf