fixed book being slow

release-1.0.0
DustyP 8 years ago
parent 82cf5d9856
commit 08d8f424be

@ -248,14 +248,8 @@ class Book:
else: else:
await self._message.edit(content=self._pages[self._current_page], embed=None) await self._message.edit(content=self._pages[self._current_page], embed=None)
# noinspection PyUnresolvedReferences
for emoji in self._bot.book_emojis.values():
try:
await self._message.add_reaction(emoji)
except (discord.Forbidden, KeyError):
pass
async def create_book(self) -> None: async def create_book(self) -> None:
# noinspection PyUnresolvedReferences
async def reaction_checker(): async def reaction_checker():
def check(reaction, user): def check(reaction, user):
if self._locked: if self._locked:
@ -265,6 +259,12 @@ class Book:
await self.display_page() await self.display_page()
for emoji in self._bot.book_emojis.values():
try:
await self._message.add_reaction(emoji)
except (discord.Forbidden, KeyError):
pass
while True: while True:
try: try:
reaction, user = await self._bot.wait_for('reaction_add', timeout=60, check=check) reaction, user = await self._bot.wait_for('reaction_add', timeout=60, check=check)
@ -297,7 +297,3 @@ class Book:
await self.display_page() await self.display_page()
self._bot.loop.create_task(reaction_checker()) self._bot.loop.create_task(reaction_checker())

Loading…
Cancel
Save