Search code examples
haskellircbots

Implementing CTCP commands in an IRC bot (Haskell)


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?


Solution

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

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