Improve NOTICE handling
The `notice` parameter is now keyword-only, and the handler now uses `functools.partial` instead of a lambda function.
This commit is contained in:
parent
12eab068be
commit
5c9b13ce87
@ -14,7 +14,7 @@ from src.utilities import irc_equals
|
||||
|
||||
hook = decorators.hook
|
||||
|
||||
def on_privmsg(cli, rawnick, chan, msg, notice = False):
|
||||
def on_privmsg(cli, rawnick, chan, msg, *, notice=False):
|
||||
try:
|
||||
prefixes = getattr(var, "STATUSMSG_PREFIXES")
|
||||
except AttributeError:
|
||||
|
@ -18,6 +18,7 @@
|
||||
# THE SOFTWARE.
|
||||
|
||||
import traceback
|
||||
import functools
|
||||
import sys
|
||||
import os
|
||||
|
||||
@ -53,7 +54,7 @@ def main():
|
||||
src.plog("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
|
||||
cli = IRCClient(
|
||||
{"privmsg": handler.on_privmsg,
|
||||
"notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
|
||||
"notice": functools.partial(handler.on_privmsg, notice=True),
|
||||
"": handler.unhandled},
|
||||
host=botconfig.HOST,
|
||||
port=botconfig.PORT,
|
||||
|
Loading…
Reference in New Issue
Block a user