mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
fix some discord.NotFound errors in paginator
This commit is contained in:
parent
165faa631f
commit
70c88e61f1
1 changed files with 6 additions and 5 deletions
|
@ -5,11 +5,9 @@ import typing
|
|||
import discord
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
# Copyright © 2016-2017 Pandentia and contributors
|
||||
# https://github.com/Thessia/Liara/blob/75fa11948b8b2ea27842d8815a32e51ef280a999/cogs/utils/paginator.py
|
||||
|
||||
|
||||
class Paginator:
|
||||
def __init__(self, ctx: Context, pages: typing.Iterable, *, timeout=300, delete_message=False,
|
||||
delete_message_on_timeout=False, text_message=None):
|
||||
|
@ -81,7 +79,8 @@ class Paginator:
|
|||
delete = self.delete_msg
|
||||
|
||||
if delete:
|
||||
await self._message.delete()
|
||||
with contextlib.suppress(discord.HTTPException):
|
||||
await self._message.delete()
|
||||
else:
|
||||
await self._clear_reactions()
|
||||
self._stopped = True
|
||||
|
@ -91,7 +90,10 @@ class Paginator:
|
|||
await self._message.clear_reactions()
|
||||
except discord.Forbidden:
|
||||
for button in self.navigation:
|
||||
await self._message.remove_reaction(button, self._message.author)
|
||||
with contextlib.suppress(discord.HTTPException):
|
||||
await self._message.remove_reaction(button, self._message.author)
|
||||
except discord.HTTPException:
|
||||
pass
|
||||
|
||||
async def format_page(self):
|
||||
self._embed.description = self.pages[self._page]
|
||||
|
@ -126,7 +128,6 @@ class Paginator:
|
|||
self._page = len(self.pages) - 1
|
||||
await self.format_page()
|
||||
|
||||
|
||||
class ListPaginator(Paginator):
|
||||
def __init__(self, ctx, _list: list, per_page=10, **kwargs):
|
||||
pages = []
|
||||
|
|
Loading…
Reference in a new issue