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)
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"),

View File

@ -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