Commit 6fa50f2c authored by Mindiell's avatar Mindiell
Browse files

Timer testing method added; timer reset modified

parent 283eb2b1
......@@ -29,6 +29,8 @@ class Admin():
return self.admin_del(user, msg)
elif command == "timer":
return self.admin_timer(user)
elif command == "testtimer":
return self.admin_testtimer(user)
def admin_list(self, user):
......@@ -108,3 +110,13 @@ class Admin():
return "REACTOR"
return "Désolé, il ne semble pas que vous ayez les droits pour cette commande."
def admin_testtimer(self, user):
Test if timer is still alive.
Log.debug("admin_testtimer command")
if is_moderator(user):
return "Désolé, il ne semble pas que vous ayez les droits pour cette commande."
......@@ -37,6 +37,7 @@ class Wantzel(object):
self.irc = IrcClientFactory(config)
self.irc.set_privmsg = self.set_privmsg
reactor.connectTCP(config.server, config.port, self.irc)
self.test_timer = False
# Loop call
self.loop = task.LoopingCall(self.timer)
......@@ -46,6 +47,10 @@ class Wantzel(object):
This method launches function regularly (see config.timer).
Log.debug("Timer called")
# Testing timer ?
if self.test_timer:
self.send_message("#lqdn-travail", "Timer fonctionnel!")
self.test_timer = False
# Tweeting Press reviews f necessary
# Bot tries to list RP channel users, if it can't, then it is no more an op and shall
......@@ -163,10 +168,14 @@ class Wantzel(object):
result = self.admin.admin(user, msg)
if result=="REACTOR":
# Recalling the timer
# Re-creating timer
self.loop = task.LoopingCall(self.timer)
except Exception:
elif result=="REACTOR":
self.test_timer = True
self.send_message(channel, "Test du timer en cours...")
self.send_message(channel, result)
self.send_message(channel, fun(user, channel, msg))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment