Added pages

This commit is contained in:
Robert 2020-08-11 13:16:57 +02:00
parent 86986f977b
commit 6290a314df

View file

@ -8,6 +8,16 @@ class JishoObject():
self.total_pages = self.response.entries
self.page = 0
def prev(self):
self.page -= 1
if self.page < 0:
self.page = self.total_pages - 1
def next(self):
self.page += 1
if self.page >= self.total_pages:
self.page = 0
class Search(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@ -39,11 +49,21 @@ class Search(commands.Cog):
embed.set_footer(
text = node.ftags
text = f"{node.ftags} \t\t {self.activeObject.page + 1}/{self.activeObject.total_pages}"
)
return embed
@commands.Cog.listener()
async def on_reaction_add(self, reaction, user):
if user == self.bot.user:
return
if reaction.me:
if reaction.emoji == "⬅️":
pass
@commands.command(name="search", description="Searches Jisho", usage="<query>", aliases=["s"])
@commands.cooldown(1, 5)
async def search(self, ctx: commands.Context, *, query: str = None):