diff --git a/royalnet/commands/commandargs.py b/royalnet/commands/commandargs.py index 1ee27015..cd5e192d 100644 --- a/royalnet/commands/commandargs.py +++ b/royalnet/commands/commandargs.py @@ -38,7 +38,7 @@ class CommandArgs(list): raise InvalidInputError("Not enough arguments") return " ".join(self) - def match(self, pattern: typing.Union[str, typing.Pattern]) -> typing.Sequence[typing.AnyStr]: + def match(self, pattern: typing.Union[str, typing.Pattern], *flags) -> typing.Sequence[typing.AnyStr]: """Match the :py:func:`royalnet.utils.commandargs.joined` to a regex pattern. Parameters: @@ -50,7 +50,7 @@ class CommandArgs(list): Returns: The matched groups, as returned by :py:func:`re.Match.groups`.""" text = self.joined() - match = re.match(pattern, text) + match = re.match(pattern, text, *flags) if match is None: raise InvalidInputError("Pattern didn't match") return match.groups() diff --git a/royalnet/commands/royalgames/mm.py b/royalnet/commands/royalgames/mm.py index 602e3e6a..e6d7c5fb 100644 --- a/royalnet/commands/royalgames/mm.py +++ b/royalnet/commands/royalgames/mm.py @@ -3,6 +3,7 @@ import dateparser import os import telegram import asyncio +import re from ..command import Command from ..commandargs import CommandArgs from ..commanddata import CommandData @@ -84,7 +85,7 @@ class MmCommand(Command): if mmresponse.response == "YES": text += f"✅ {mmresponse.royal}\n" elif mmresponse.response == "NO": - text += "❌ {mmresponse.royal}\n" + text += f"❌ {mmresponse.royal}\n" return text async def _run_mm(self, mmevent: MMEvent) -> None: @@ -336,9 +337,9 @@ class MmCommand(Command): client: telegram.Bot = self.interface.bot.client creator = await data.get_author(error_if_none=True) try: - timestring, title, description = args.match(r"\[\s*([^]]+)\s*]\s*([^\n]+)\s*\n?\s*(.+)?\s*") + timestring, title, description = args.match(r"\[\s*([^]]+)\s*]\s*([^\n]+)\s*\n?\s*(.+)?\s*", re.DOTALL) except InvalidInputError: - timestring, title, description = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*\n?\s*(.+)?\s*") + timestring, title, description = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*\n?\s*(.+)?\s*", re.DOTALL) try: dt: typing.Optional[datetime.datetime] = dateparser.parse(timestring) except OverflowError: