search option for view commands
All checks were successful
Build and Push Docker Image / build (push) Successful in 7s

This commit is contained in:
Corban-Lee Jones 2024-08-21 17:20:48 +01:00
parent 7b1a293891
commit e43d7aacf9

View File

@ -102,7 +102,7 @@ class CommandsCog(commands.Cog):
) )
@view_group.command(name="subscriptions") @view_group.command(name="subscriptions")
async def cmd_list_subs(self, inter: Interaction): async def cmd_list_subs(self, inter: Interaction, search: str = ""):
"""List Subscriptions from this server.""" """List Subscriptions from this server."""
await inter.response.defer() await inter.response.defer()
@ -126,7 +126,10 @@ class CommandsCog(commands.Cog):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
api = API(self.bot.api_token, session) api = API(self.bot.api_token, session)
return await api.get_subscriptions( return await api.get_subscriptions(
guild_id=inter.guild.id, page=page, page_size=pagesize guild_id=inter.guild.id,
page=page,
page_size=pagesize,
search=search
) )
embed = Followup(f"Subscriptions in {inter.guild.name}").info()._embed embed = Followup(f"Subscriptions in {inter.guild.name}").info()._embed
@ -142,7 +145,7 @@ class CommandsCog(commands.Cog):
await pagination.send() await pagination.send()
@view_group.command(name="tracked-content") @view_group.command(name="tracked-content")
async def cmd_list_tracked(self, inter: Interaction): async def cmd_list_tracked(self, inter: Interaction, search: str = ""):
"""List Tracked Content from this server, or a given sub""" """List Tracked Content from this server, or a given sub"""
await inter.response.defer() await inter.response.defer()
@ -161,7 +164,10 @@ class CommandsCog(commands.Cog):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
api = API(self.bot.api_token, session) api = API(self.bot.api_token, session)
return await api.get_tracked_content( return await api.get_tracked_content(
subscription__guild_id=inter.guild_id, page=page, page_size=pagesize subscription__guild_id=inter.guild_id,
page=page,
page_size=pagesize,
search=search
) )
embed = Followup(f"Tracked Content in {inter.guild.name}").info()._embed embed = Followup(f"Tracked Content in {inter.guild.name}").info()._embed