From 41c05dbf4009e2151eb1ae1d23557e9c3d65393d Mon Sep 17 00:00:00 2001 From: skelmis Date: Wed, 23 Feb 2022 00:22:38 +1300 Subject: [PATCH] Close #28 --- examples/embed_pages.py | 9 +++++---- nextcord/ext/menus/menus.py | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/embed_pages.py b/examples/embed_pages.py index b734318..9fb1316 100644 --- a/examples/embed_pages.py +++ b/examples/embed_pages.py @@ -13,9 +13,10 @@ async def format_page(self, menu, entries): embed = Embed(title="Entries") for entry in entries: embed.add_field(name=entry[0], value=entry[1], inline=True) - embed.set_footer(text=f'Page {menu.current_page + 1}/{self.get_max_pages()}') + embed.set_footer(text=f"Page {menu.current_page + 1}/{self.get_max_pages()}") return embed + @bot.command() async def button_embed_field(ctx): data = [ @@ -66,13 +67,13 @@ def __init__(self, data): async def format_page(self, menu, entries): embed = Embed(title="Entries", description="\n".join(entries)) - embed.set_footer(text=f'Page {menu.current_page + 1}/{self.get_max_pages()}') + embed.set_footer(text=f"Page {menu.current_page + 1}/{self.get_max_pages()}") return embed @bot.command() async def button_embed_description(ctx): - data = [f'Description for entry #{num}' for num in range(1, 51)] + data = [f"Description for entry #{num}" for num in range(1, 51)] pages = menus.ButtonMenuPages( source=MyEmbedDescriptionPageSource(data), clear_buttons_after=True, @@ -80,4 +81,4 @@ async def button_embed_description(ctx): await pages.start(ctx) -bot.run('token') +bot.run("token") diff --git a/nextcord/ext/menus/menus.py b/nextcord/ext/menus/menus.py index 8152eaf..2110a4c 100644 --- a/nextcord/ext/menus/menus.py +++ b/nextcord/ext/menus/menus.py @@ -459,7 +459,10 @@ def _verify_permissions( channel: nextcord.abc.Messageable, permissions: Permissions, ): - if not permissions.send_messages: + 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: raise CannotSendMessages() if self.check_embeds and not permissions.embed_links: