4

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?

Jonno_FTW
  • 8,601
  • 7
  • 58
  • 90

1 Answers1

2

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

write "NOTICE" (sender++"\001VERSION Haskellbot : v1.0 : GHCi\001")
Jonno_FTW
  • 8,601
  • 7
  • 58
  • 90
  • 1
    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 Mar 18 '10 at 22:51