Fixed number checker
This commit is contained in:
parent
88d0af40c5
commit
cb7290be00
@ -380,15 +380,16 @@ class Book:
|
|||||||
elif str(reaction.emoji) == self._bot.book_emojis['start']:
|
elif str(reaction.emoji) == self._bot.book_emojis['start']:
|
||||||
self._current_page = 0
|
self._current_page = 0
|
||||||
elif str(reaction.emoji) == self._bot.book_emojis['hash']:
|
elif str(reaction.emoji) == self._bot.book_emojis['hash']:
|
||||||
m = await self._channel.send(f'Please enter a number between 1 and {self._len_pages}')
|
m = await self._channel.send(f'Please enter a number in range 1 to {self._len_pages}')
|
||||||
|
|
||||||
def num_check(message):
|
def num_check(message):
|
||||||
if self._locked:
|
if self._locked:
|
||||||
return message.content.isdigit() \
|
return message.content.isdigit() \
|
||||||
and 0 < int(message.content) < self._len_pages \
|
and 0 < int(message.content) <= self._len_pages \
|
||||||
and message.author == self._calling_message.author
|
and message.author == self._calling_message.author
|
||||||
else:
|
else:
|
||||||
return message.content.isdigit() \
|
return message.content.isdigit() \
|
||||||
and 0 < int(message.content) < self._len_pages
|
and 0 < int(message.content) <= self._len_pages
|
||||||
|
|
||||||
try:
|
try:
|
||||||
msg = await self._bot.wait_for('message', timeout=30, check=num_check)
|
msg = await self._bot.wait_for('message', timeout=30, check=num_check)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user