Search code examples
pythontwistedirc

Getting the topic of a channel in a twisted IRC bot


I am having trouble getting the topic of a channel using the twisted irc framework. My bot joins one channel and I want it to be able to query the topic of another channel. I send a LIST message using topic('#channelname) and I thought I would get the response by overriding the topicUpdated() method, but that isn't getting called. I also tried overriding irc_RPL_TOPIC() but that isn't getting called either. Yes the channel exists, yes it has a topic, and yes I can get the topic using raw sockets.

What is the proper way to get the topic of a channel using twisted.words.protocols.irc?

Thanks


Solution

  • RFC 1459 states that when using LIST, each channel and its topic are sent with the numeric 332 (aka. RPL_LIST).

    I don't know how Twisted works, but you should be able to get them with a method named irc_RPL_LIST, irc_332, or something similar.