mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Update MessageConverter link regex
Remove redundant parts of the MessageConverter regexes and support www
This commit is contained in:
parent
873ed87caa
commit
c54d6f03c5
@ -254,12 +254,11 @@ class MessageConverter(Converter):
|
||||
.. versionchanged:: 1.5
|
||||
Raise :exc:`.ChannelNotFound`, `MessageNotFound` or `ChannelNotReadable` instead of generic :exc:`.BadArgument`
|
||||
"""
|
||||
|
||||
async def convert(self, ctx, argument):
|
||||
id_regex = re.compile(r'^(?:(?P<channel_id>[0-9]{15,21})-)?(?P<message_id>[0-9]{15,21})$')
|
||||
id_regex = re.compile(r'(?:(?P<channel_id>[0-9]{15,21})-)?(?P<message_id>[0-9]{15,21})$')
|
||||
link_regex = re.compile(
|
||||
r'^https?://(?:(ptb|canary)\.)?discord(?:app)?\.com/channels/'
|
||||
r'(?:([0-9]{15,21})|(@me))'
|
||||
r'https?://(?:(ptb|canary|www)\.)?discord(?:app)?\.com/channels/'
|
||||
r'(?:[0-9]{15,21}|@me)'
|
||||
r'/(?P<channel_id>[0-9]{15,21})/(?P<message_id>[0-9]{15,21})/?$'
|
||||
)
|
||||
match = id_regex.match(argument) or link_regex.match(argument)
|
||||
|
Loading…
x
Reference in New Issue
Block a user