From 3718192b9c84e93c6bbb6318645f4afb62865ce4 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 12 Mar 2022 21:01:07 -0500 Subject: [PATCH] Raise a TypeError if a non-View is passed to Webhook.send --- discord/webhook/async_.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 6781bc036..2d06a953b 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -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