Update discord-ext-menus vendor to commit 84caae8038d0d3adc860957ccef05baeec2e2dd8 (#4167)

This commit is contained in:
jack1142 2020-08-06 18:44:40 +02:00 committed by GitHub
parent 5f52fb872a
commit 09933e22f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
The MIT License (MIT) 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 Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),

View File

@ -541,13 +541,14 @@ class Menu(metaclass=_MenuMeta):
""" """
if payload.message_id != self.message.id: if payload.message_id != self.message.id:
return False 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 False
return payload.emoji in self.buttons return payload.emoji in self.buttons
async def _internal_loop(self): async def _internal_loop(self):
try: try:
self.__timed_out = False
loop = self.bot.loop loop = self.bot.loop
# Ensure the name exists for the cancellation handling # Ensure the name exists for the cancellation handling
tasks = [] tasks = []
@ -579,7 +580,7 @@ class Menu(metaclass=_MenuMeta):
# consider this my warning. # consider this my warning.
except asyncio.TimeoutError: except asyncio.TimeoutError:
pass self.__timed_out = True
finally: finally:
self._event.set() self._event.set()
@ -588,9 +589,11 @@ class Menu(metaclass=_MenuMeta):
task.cancel() task.cancel()
try: try:
await self.finalize() await self.finalize(self.__timed_out)
except Exception: except Exception:
pass pass
finally:
self.__timed_out = False
# Can't do any requests if the bot is closed # Can't do any requests if the bot is closed
if self.bot.is_closed(): if self.bot.is_closed():
@ -701,12 +704,17 @@ class Menu(metaclass=_MenuMeta):
if wait: if wait:
await self._event.wait() await self._event.wait()
async def finalize(self): async def finalize(self, timed_out):
"""|coro| """|coro|
A coroutine that is called when the menu loop has completed A coroutine that is called when the menu loop has completed
its run. This is useful if some asynchronous clean-up is its run. This is useful if some asynchronous clean-up is
required after the fact. required after the fact.
Parameters
--------------
timed_out: :class:`bool`
Whether the menu completed due to timing out.
""" """
return return