Browse Source

Allow Interaction webhook URLs to be used in Webhook.from_url

pull/9422/head
Rapptz 2 years ago
parent
commit
3951b61440
  1. 2
      discord/webhook/async_.py
  2. 2
      discord/webhook/sync.py

2
discord/webhook/async_.py

@ -1275,7 +1275,7 @@ class Webhook(BaseWebhook):
A partial :class:`Webhook`.
A partial webhook is just a webhook object with an ID and a token.
"""
m = re.search(r'discord(?:app)?\.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9\.\-\_]{60,68})', url)
m = re.search(r'discord(?:app)?\.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9\.\-\_]{60,})', url)
if m is None:
raise ValueError('Invalid webhook URL given.')

2
discord/webhook/sync.py

@ -682,7 +682,7 @@ class SyncWebhook(BaseWebhook):
A partial :class:`SyncWebhook`.
A partial :class:`SyncWebhook` is just a :class:`SyncWebhook` object with an ID and a token.
"""
m = re.search(r'discord(?:app)?\.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9\.\-\_]{60,68})', url)
m = re.search(r'discord(?:app)?\.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9\.\-\_]{60,})', url)
if m is None:
raise ValueError('Invalid webhook URL given.')

Loading…
Cancel
Save