'received.numeric.###' -> 'received.###' throughout project

This commit is contained in:
jesopo 2019-02-16 15:53:14 +00:00
parent 342c1afa7e
commit faf2401069
9 changed files with 15 additions and 19 deletions

View file

@ -3,7 +3,7 @@ from src import ModuleManager, utils
@utils.export("serverset", {"setting": "bot-channel",
"help": "Set main channel"})
class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.001")
@utils.hook("received.001")
def do_join(self, event):
bot_channel = event["server"].get_setting("bot-channel",
self.bot.config.get("bot-channel", "#bitbot"))

View file

@ -1,7 +1,7 @@
from src import ModuleManager, utils
class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.001")
@utils.hook("received.001")
def on_connect(self, event):
channels = event["server"].get_setting("autojoin", [])
if not channels:

View file

@ -33,11 +33,7 @@ class Module(ModuleManager.BaseModule):
self.events.on("raw.received").on(line.command).call_unsafe(**kwargs)
if default_event or not hooks:
if line.command.isdigit():
self.events.on("received.numeric").on(line.command).call(
**kwargs)
else:
self.events.on("received").on(line.command).call(**kwargs)
self.events.on("received").on(line.command).call(**kwargs)
@utils.hook("raw.received")
def handle_raw(self, event):

View file

@ -9,10 +9,10 @@ class Module(ModuleManager.BaseModule):
else:
self.timers.add("ison-check", 30, server=server)
@utils.hook("received.numeric.376")
@utils.hook("received.376")
def end_of_motd(self, event):
self._done_connecting(event["server"])
@utils.hook("received.numeric.422")
@utils.hook("received.422")
def no_motd(self, event):
self._done_connecting(event["server"])
@ -23,7 +23,7 @@ class Module(ModuleManager.BaseModule):
if "MONITOR" in event["server"].isupport:
event["server"].send("MONITOR - %s " % target_nick)
@utils.hook("received.numeric.731")
@utils.hook("received.731")
def mon_offline(self, event):
target_nick = event["server"].connection_params.nickname
nicks = event["args"][1].split(",")
@ -39,7 +39,7 @@ class Module(ModuleManager.BaseModule):
event["server"].send("ISON %s" % target_nick)
event["timer"].redo()
@utils.hook("received.numeric.303")
@utils.hook("received.303")
def ison_response(self, event):
target_nick = event["server"].connection_params.nickname
if not event["args"][1] and not event["server"].irc_equals(

View file

@ -4,7 +4,7 @@ from src import EventManager, ModuleManager, utils
@utils.export("serverset", {"setting": "nickserv-password",
"help": "Set the nickserv password for this server"})
class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT)
@utils.hook("received.001", priority=EventManager.PRIORITY_URGENT)
def on_connect(self, event):
nickserv_password = event["server"].get_setting("nickserv-password")
if nickserv_password:

View file

@ -1,7 +1,7 @@
from src import EventManager, ModuleManager, utils
class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT)
@utils.hook("received.001", priority=EventManager.PRIORITY_URGENT)
def on_connect(self, event):
commands = event["server"].get_setting("perform", [])
for i, command in enumerate(commands):

View file

@ -118,7 +118,7 @@ class Module(ModuleManager.BaseModule):
def on_topic(self, event):
self._on_topic(event, event["user"].nickname, "changed",
event["topic"], event["channel"])
@utils.hook("received.numeric.333")
@utils.hook("received.333")
def on_333(self, event):
self._on_topic(event, event["setter"], "set",
event["channel"].topic, event["channel"])
@ -142,7 +142,7 @@ class Module(ModuleManager.BaseModule):
self.print_line(event, "%s was renamed to %s" % (
event["old_name"], event["new_name"]))
@utils.hook("received.numeric.376")
@utils.hook("received.376")
def motd_end(self, event):
for line in event["server"].motd_lines:
self.print_line(event, "[MOTD] %s" % line)

View file

@ -52,7 +52,7 @@ class Module(ModuleManager.BaseModule):
event["server"].capability_done("resume")
@utils.hook("received.numeric.001")
@utils.hook("received.001")
def on_connect(self, event):
event["server"].del_setting("resume-channels")

View file

@ -131,17 +131,17 @@ class Module(ModuleManager.BaseModule):
def _end_sasl(self, server):
server.capability_done("sasl")
@utils.hook("received.numeric.908")
@utils.hook("received.908")
def sasl_mechanisms(self, event):
server_mechanisms = event["args"][1].split(",")
mechanism = self._best_userpass_mechanism(server_mechanimsms)
event["server"].sasl_mechanism = mechanism
event["server"].send_authenticate(mechanism)
@utils.hook("received.numeric.903")
@utils.hook("received.903")
def sasl_success(self, event):
self._end_sasl(event["server"])
@utils.hook("received.numeric.904")
@utils.hook("received.904")
def sasl_failure(self, event):
self.log.warn("SASL failure for %s: %s",
[str(event["server"]), event["args"][1]])