From 0a23e71e4e4a631255403a1ae201ff03b7b15f53 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 23 May 2019 16:03:49 +0100 Subject: .lstrip alphanumeric chars from private commands --- modules/commands/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index 140ebc35..1cc3e63a 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -1,4 +1,4 @@ -import re +import re, string from src import EventManager, ModuleManager, utils from . import outs @@ -9,6 +9,8 @@ REGEX_ARG_NUMBER = re.compile(r"\$(\d+)(-?)") MSGID_TAG = utils.irc.MessageTag("msgid", "draft/msgid") +NON_ALPHANUMERIC = [char for char in string.printable if char.isalnum()] + def _command_method_validate(s): if s.upper() in COMMAND_METHODS: return s.upper() @@ -261,6 +263,7 @@ class Module(ModuleManager.BaseModule): def private_message(self, event): if event["message_split"] and not event["action"]: command = event["message_split"][0].lower() + command = command.lstrip("".join(NON_ALPHANUMERIC)) args_split = event["message_split"][1:] hook, args_split = self._find_command_hook(event["server"], command, -- cgit v1.3.1-10-gc9f91