.lstrip alphanumeric chars from private commands
This commit is contained in:
parent
e2a878def1
commit
0a23e71e4e
1 changed files with 4 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
import re
|
import re, string
|
||||||
from src import EventManager, ModuleManager, utils
|
from src import EventManager, ModuleManager, utils
|
||||||
from . import outs
|
from . import outs
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ REGEX_ARG_NUMBER = re.compile(r"\$(\d+)(-?)")
|
||||||
|
|
||||||
MSGID_TAG = utils.irc.MessageTag("msgid", "draft/msgid")
|
MSGID_TAG = utils.irc.MessageTag("msgid", "draft/msgid")
|
||||||
|
|
||||||
|
NON_ALPHANUMERIC = [char for char in string.printable if char.isalnum()]
|
||||||
|
|
||||||
def _command_method_validate(s):
|
def _command_method_validate(s):
|
||||||
if s.upper() in COMMAND_METHODS:
|
if s.upper() in COMMAND_METHODS:
|
||||||
return s.upper()
|
return s.upper()
|
||||||
|
@ -261,6 +263,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
def private_message(self, event):
|
def private_message(self, event):
|
||||||
if event["message_split"] and not event["action"]:
|
if event["message_split"] and not event["action"]:
|
||||||
command = event["message_split"][0].lower()
|
command = event["message_split"][0].lower()
|
||||||
|
command = command.lstrip("".join(NON_ALPHANUMERIC))
|
||||||
args_split = event["message_split"][1:]
|
args_split = event["message_split"][1:]
|
||||||
|
|
||||||
hook, args_split = self._find_command_hook(event["server"], command,
|
hook, args_split = self._find_command_hook(event["server"], command,
|
||||||
|
|
Loading…
Reference in a new issue