Raise a TypeError if a non-View is passed to Webhook.send

This commit is contained in:
Rapptz 2022-03-12 21:01:07 -05:00
parent 42beec9fa9
commit 3718192b9c

View File

@ -1471,6 +1471,10 @@ class Webhook(BaseWebhook):
if view is not MISSING:
if isinstance(self._state, _WebhookState):
raise ValueError('Webhook views require an associated state with the webhook')
if not hasattr(view, '__discord_ui_view__'):
raise TypeError(f'expected view parameter to be of type View not {view.__class__!r}')
if ephemeral is True and view.timeout is None:
view.timeout = 15 * 60.0