Python IRC bot using Twisted

Jean-Paul Calderone exarkun at divmod.com
Wed Jul 11 07:25:15 EDT 2007


On Wed, 11 Jul 2007 03:51:27 -0700, ddtm <dr.death.tm at gmail.com> wrote:
>I have another problem with my IRC bot. There is privmsg(self, user,
>channel, msg) function (this function handles the incoming IRC data)
>in the code that was mentioned above. I have a special condition in
>this function that if a user sends to bot a private message (in other
>words: if channel == self.nickname) bot sends it to the main channel.
>Everything works fine except sending message to the main channel (for
>example #www). I write something like this:
>if channel == self.nickname:
>  self.msg('www', msg)
>This code doesn't work. But if try to send private message back to
>user:
>if channel == self.nickname:
>  self.msg(user, msg)
>everything works fine. I really don't know what to do.
>

self.msg('www', msg) will send msg to the user named `www'.  To send
to channels, be sure to include the '#' prefix.

Jean-Paul



More information about the Python-list mailing list