Implement initial WHO loop delay
This commit is contained in:
parent
d9ec68708b
commit
d68f0589cb
|
@ -57,6 +57,7 @@
|
||||||
"Prefix": "*"
|
"Prefix": "*"
|
||||||
},
|
},
|
||||||
"Delays": {
|
"Delays": {
|
||||||
|
"WhoDelay": 3600,
|
||||||
"WhoLoop": 600,
|
"WhoLoop": 600,
|
||||||
"WhoRange": 1800,
|
"WhoRange": 1800,
|
||||||
"Timeout": 30,
|
"Timeout": 30,
|
||||||
|
|
22
core/bot.py
22
core/bot.py
|
@ -690,17 +690,27 @@ class IRCBot(IRCClient):
|
||||||
if not self.authenticated:
|
if not self.authenticated:
|
||||||
reactor.callLater(10, self.regPing)
|
reactor.callLater(10, self.regPing)
|
||||||
|
|
||||||
|
def setup_who_loop(self, channel):
|
||||||
|
# if main.config["Toggles"]["Who"]:
|
||||||
|
lc = LoopingCall(self.who, channel)
|
||||||
|
self._getWho[channel] = lc
|
||||||
|
intrange = main.config["Tweaks"]["Delays"]["WhoRange"]
|
||||||
|
minint = main.config["Tweaks"]["Delays"]["WhoLoop"]
|
||||||
|
interval = randint(minint, minint + intrange)
|
||||||
|
lc.start(interval)
|
||||||
|
|
||||||
def joined(self, channel):
|
def joined(self, channel):
|
||||||
if channel not in self.channels:
|
if channel not in self.channels:
|
||||||
self.channels.append(channel)
|
self.channels.append(channel)
|
||||||
self.names(channel).addCallback(self.got_names)
|
self.names(channel).addCallback(self.got_names)
|
||||||
if main.config["Toggles"]["Who"]:
|
if main.config["Toggles"]["Who"]:
|
||||||
lc = LoopingCall(self.who, channel)
|
reactor.callLater(main.config["Tweaks"]["Delays"]["WhoDelay"], self.setup_who_loop, channel)
|
||||||
self._getWho[channel] = lc
|
# lc = LoopingCall(self.who, channel)
|
||||||
intrange = main.config["Tweaks"]["Delays"]["WhoRange"]
|
# self._getWho[channel] = lc
|
||||||
minint = main.config["Tweaks"]["Delays"]["WhoLoop"]
|
# intrange = main.config["Tweaks"]["Delays"]["WhoRange"]
|
||||||
interval = randint(minint, minint + intrange)
|
# minint = main.config["Tweaks"]["Delays"]["WhoLoop"]
|
||||||
lc.start(interval)
|
# interval = randint(minint, minint + intrange)
|
||||||
|
# lc.start(interval)
|
||||||
|
|
||||||
def botLeft(self, channel):
|
def botLeft(self, channel):
|
||||||
if channel in self.channels:
|
if channel in self.channels:
|
||||||
|
|
Loading…
Reference in New Issue