Open Red-M opened 6 years ago
Thank you
There seem to be two bugs with this. 1). The timer does not start until someone interacts with the bot. 2). "return" and "print" don't print to IRC. (they do, however, print to the console window.)
I made a fresh clone of your fork to make sure the issue wasn't from something else and it's still happening. Using your exact example plugin code, too. I'm sure I'm missing something obvious here, but "say", "message", "return" and "print" don't send text to IRC. I tried to look at the command function to see how it passes information to IRC, and all I can tell is that it just "returns" it.
It looks like dispatch doesn't have a way to handle input from a timer. See here: https://github.com/Red-M/skybot/blob/f051014fca683b3f309ef9655fd513f22c9fef35/core/main.py#L132-L153
You just need to find the IRC server object in bot
then you can use a .msg
I did put that timers won't start until someone says something in the commits.
Timers are called when someone speaks anywhere for the first time. Use @hook.event('004') to start timers on bot connect.
An example for messaging a channel using default config values:
bot.conns['local irc'].msg("#channel','text')
I've included this in the PR comment for future use.
Did this work for you?
Prevention of duplicate timers should also be implemented in my opinion. Event 004 can trigger multiple times if the network connection is flaky, which would lead to multiple running timers for the same hook.
105 😃
Timers are called when someone speaks anywhere for the first time and only once. Use
@hook.event('004')
to start timers on bot connect.An example:
An example for messaging a channel using default config values and at bot start up: