rawsonj / triviabot

A simple IRC trivia bot written in python using twisted.
GNU General Public License v3.0
41 stars 51 forks source link

add config option for different WAIT_INTERVAL #66

Closed andy5995 closed 8 years ago

andy5995 commented 8 years ago

I suggest adding an option so the time between clues can be set differently than the time between questions. This would give admins some flexibility on what kind of "atmosphere" they'd like in their channels.

I'll write this code if you agree.

andy5995 commented 8 years ago

In the code, I see that after a skipped question there is self._lc.start(config.WAIT_INTERVAL) but it's being ignored for some reason; the next question starts immediately.

rawsonj commented 8 years ago

I'm not opposed to having different delay values, but the primary purpose of the delay value is to make the bot safe from flood protection on IRC servers. You give it a value that's effectively the max rate at which the bot can post messages without being kicked from the server.

The reason why skipping starts immediately is on line 409 of trivia.py.

Basically, ?skip actually stops the LoopingCall timer and starts it again, causing an immediate flushing of the current state and executing _play_game immediately, which loads the next question and asks it. The timer is then set and the LoopingCall repeatedly calls _play_game on it's timer.

Reviewing this mechanism, I don't think it is possible using twisted to have different intervals for clues vs. questions, since it's all being driven with one LoopingCall object that has a single time.

andy5995 commented 8 years ago

Ok, thanks for the explanation, Joe. I'll close it out.