From 7ba4d972b3a948409c428154689bfd86bf1bc528 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Fri, 29 Jul 2022 18:25:52 -0600 Subject: [PATCH] fix: Prevent CannotSendMessages or CannotEmbedLinks on interaction (#45) --- nextcord/ext/menus/menus.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nextcord/ext/menus/menus.py b/nextcord/ext/menus/menus.py index a9759f2..90daf37 100644 --- a/nextcord/ext/menus/menus.py +++ b/nextcord/ext/menus/menus.py @@ -469,12 +469,13 @@ def _verify_permissions( permissions: Permissions, ): is_thread = isinstance(channel, nextcord.Thread) - if is_thread and not permissions.send_messages_in_threads: - raise CannotSendMessages() - elif not is_thread and not permissions.send_messages: + if ctx is not None and ( + (is_thread and not permissions.send_messages_in_threads) + or (not is_thread and not permissions.send_messages) + ): raise CannotSendMessages() - if self.check_embeds and not permissions.embed_links: + if ctx is not None and self.check_embeds and not permissions.embed_links: raise CannotEmbedLinks() self._can_remove_reactions = permissions.manage_messages