Python IRC bot module help?
#!/usr/bin/python
def welcome_message(phenny, input):
phenny.say('Welcome to #example channel ' + input.nick + ' !')
welcome_message.event = 'JOIN'
welcome_message.rule = r'.*'
This code works perfect despite that it repeats the message 2 times, like this:
<phenny> Welcome to #example channel visitornick !
<phenny> Welcome to #example channel visitornick !
开发者_StackOverflow
Why this happens ?? I dont think I did any mistake in code.. coild it be connetion fault ??
The error is obviusly not with the function itself, so my guess is that the trigger is occurring twice.
Try debugging a bit: put a print
in the function call, and see if the event is indeed triggered twice.
Comment this answer when you know more, and I'll update :)
This is a documented error. However, it seems it is because of how phenny's core handles threading. It doesn't appear this has been fixed yet.
精彩评论