Only delay messages when needed
Currently, every message is delayed by 500ms (send
in IRCBot
). It would be preferable if this delay is only induced when needed to avoid throttling. One way to do this is to move the sleep
call to after send_MT
. This is still rather conservative; if a state is kept with the timestamps of previous messages the delay would not have to be used if only one other message has been sent recently. A slightly simpler (though again, more conservative) way would be to keep a counter of recent messages, and when it reaches a certain threshold delay for a certain amount of time (longer than 500ms).