WatchWebsite module: dusting & fix unwatch authorizations
This commit is contained in:
parent
d985b71373
commit
c15127feb8
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<nemubotmodule name="watchWebsite">
|
||||
<message type="cmd" name="watch" call="add_site" data="diff" />
|
||||
<message type="cmd" name="updown" call="add_site" data="updown" />
|
||||
<message type="cmd" name="unwatch" call="del_site" />
|
||||
</nemubotmodule>
|
@ -24,6 +24,11 @@ def help_full ():
|
||||
|
||||
def load(context):
|
||||
"""Register watched website"""
|
||||
from hooks import Hook
|
||||
add_hook("cmd_hook", Hook(add_site, "watch", data="diff"))
|
||||
add_hook("cmd_hook", Hook(add_site, "updown", data="updown"))
|
||||
add_hook("cmd_hook", Hook(del_site, "unwatch"))
|
||||
|
||||
DATAS.setIndex("url", "watch")
|
||||
for site in DATAS.getNodes("watch"):
|
||||
if site.hasNode("alert"):
|
||||
@ -62,7 +67,7 @@ def del_site(msg):
|
||||
site = DATAS.index[url]
|
||||
for a in site.getNodes("alert"):
|
||||
if a["channel"] == msg.channel:
|
||||
if (msg.sender == a["sender"] or msg.is_owner):
|
||||
if not (msg.sender == a["sender"] or msg.is_owner):
|
||||
raise IRCException("vous ne pouvez pas supprimer cette URL.")
|
||||
site.delChild(a)
|
||||
if not site.hasNode("alert"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user