From 09933e22f6a10a7e56b1e83b3e3b42fc5bddfbf6 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Thu, 6 Aug 2020 18:44:40 +0200 Subject: [PATCH] Update `discord-ext-menus` vendor to commit 84caae8038d0d3adc860957ccef05baeec2e2dd8 (#4167) --- redbot/vendored/discord-ext-menus.LICENSE | 2 +- redbot/vendored/discord/ext/menus/__init__.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/redbot/vendored/discord-ext-menus.LICENSE b/redbot/vendored/discord-ext-menus.LICENSE index b0d778919..f71e9c169 100644 --- a/redbot/vendored/discord-ext-menus.LICENSE +++ b/redbot/vendored/discord-ext-menus.LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2019 Danny Y. (Rapptz) +Copyright (c) 2015-2020 Danny Y. (Rapptz) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/redbot/vendored/discord/ext/menus/__init__.py b/redbot/vendored/discord/ext/menus/__init__.py index 64c8980ae..142a95bd8 100644 --- a/redbot/vendored/discord/ext/menus/__init__.py +++ b/redbot/vendored/discord/ext/menus/__init__.py @@ -541,13 +541,14 @@ class Menu(metaclass=_MenuMeta): """ if payload.message_id != self.message.id: return False - if payload.user_id not in (self.bot.owner_id, self._author_id): + if payload.user_id not in {self.bot.owner_id, self._author_id, *self.bot.owner_ids}: return False return payload.emoji in self.buttons async def _internal_loop(self): try: + self.__timed_out = False loop = self.bot.loop # Ensure the name exists for the cancellation handling tasks = [] @@ -579,7 +580,7 @@ class Menu(metaclass=_MenuMeta): # consider this my warning. except asyncio.TimeoutError: - pass + self.__timed_out = True finally: self._event.set() @@ -588,9 +589,11 @@ class Menu(metaclass=_MenuMeta): task.cancel() try: - await self.finalize() + await self.finalize(self.__timed_out) except Exception: pass + finally: + self.__timed_out = False # Can't do any requests if the bot is closed if self.bot.is_closed(): @@ -701,12 +704,17 @@ class Menu(metaclass=_MenuMeta): if wait: await self._event.wait() - async def finalize(self): + async def finalize(self, timed_out): """|coro| A coroutine that is called when the menu loop has completed its run. This is useful if some asynchronous clean-up is required after the fact. + + Parameters + -------------- + timed_out: :class:`bool` + Whether the menu completed due to timing out. """ return