3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-17 14:01:03 +01:00

Irc: make throttle time configurable per server (defaults to 0.01s)

This commit is contained in:
James Lu 2016-08-21 17:24:18 -07:00
parent 7a5b64bdc9
commit a546bae341
2 changed files with 7 additions and 1 deletions

View File

@ -172,7 +172,8 @@ class Irc():
if self.queue: # Only process if there's data.
data = self.queue.popleft()
self._send(data)
time.sleep(0.01)
throttle_time = self.serverdata.get('throttle_time', 0.01)
time.sleep(throttle_time)
def connect(self):
"""

View File

@ -274,6 +274,11 @@ servers:
# Autoconnect works like usual.
autoconnect: 30
# Message throttling: when set to a non-zero value, only one message will be sent every X
# seconds. If your bot is constantly running into Excess Flood errors, raising this to
# something like 0.5 or 1.0 should help. Defaults to 0.01 if not set.
throttle_time: 0.3
# Plugins to load (omit the .py extension)
plugins:
# Commands plugin: Provides core commands such as logging in, shutting down