Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
wantzel
Commits
6fa50f2c
Commit
6fa50f2c
authored
Jun 03, 2018
by
Mindiell
Browse files
Timer testing method added; timer reset modified
parent
283eb2b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
admin.py
View file @
6fa50f2c
...
...
@@ -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"
else
:
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
"TEST_REACTOR"
else
:
return
"Désolé, il ne semble pas que vous ayez les droits pour cette commande."
wantzel.py
View file @
6fa50f2c
...
...
@@ -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
)
self
.
loop
.
start
(
config
.
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
self
.
rp
.
tweet
()
# 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"
:
try
:
# Recalling the timer
# Re-creating timer
self
.
loop
=
task
.
LoopingCall
(
self
.
timer
)
self
.
loop
.
start
(
config
.
timer
)
except
Exception
:
pass
elif
result
==
"REACTOR"
:
self
.
test_timer
=
True
self
.
send_message
(
channel
,
"Test du timer en cours..."
)
else
:
self
.
send_message
(
channel
,
result
)
self
.
send_message
(
channel
,
fun
(
user
,
channel
,
msg
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment