开发者

Python IRC bot module help?

开发者 https://www.devze.com 2023-02-25 11:28 出处:网络
I was actually making a module for phenny bot is called welcom.py and it welcomes every new guy who joins my channel

I was actually making a module for phenny bot

is called welcom.py and it welcomes every new guy who joins my channel

Here is the code I used for that:

#!/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.

0

精彩评论

暂无评论...
验证码 换一张
取 消