mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add missing f-string
This commit is contained in:
parent
a18aa5ef54
commit
2d782c53ec
2 changed files with 6 additions and 5 deletions
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue