Added pages
This commit is contained in:
parent
86986f977b
commit
6290a314df
|
@ -8,6 +8,16 @@ class JishoObject():
|
||||||
self.total_pages = self.response.entries
|
self.total_pages = self.response.entries
|
||||||
self.page = 0
|
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):
|
class Search(commands.Cog):
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
@ -39,11 +49,21 @@ class Search(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
embed.set_footer(
|
embed.set_footer(
|
||||||
text = node.ftags
|
text = f"{node.ftags} \t\t {self.activeObject.page + 1}/{self.activeObject.total_pages}"
|
||||||
)
|
)
|
||||||
|
|
||||||
return embed
|
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.command(name="search", description="Searches Jisho", usage="<query>", aliases=["s"])
|
||||||
@commands.cooldown(1, 5)
|
@commands.cooldown(1, 5)
|
||||||
async def search(self, ctx: commands.Context, *, query: str = None):
|
async def search(self, ctx: commands.Context, *, query: str = None):
|
||||||
|
|
Loading…
Reference in a new issue