rss.py > cmds.py & tracked content command

tracked content command not finished
This commit is contained in:
Corban-Lee Jones 2024-08-19 20:34:30 +01:00
parent 389fbfee26
commit dd8d4a0485

View File

@ -16,7 +16,7 @@ from discord.app_commands import Choice, Group, autocomplete, rename, command
from discord.errors import Forbidden from discord.errors import Forbidden
from api import API from api import API
from feed import Subscription, SubscriptionChannel, TrackedContent from feed import Subscription, TrackedContent
from utils import ( from utils import (
Followup, Followup,
PaginationView, PaginationView,
@ -79,7 +79,7 @@ async def validate_rss_source(nickname: str, url: str) -> Tuple[str | None, Feed
return None, feed return None, feed
class FeedCog(commands.Cog): class CommandsCog(commands.Cog):
""" """
Command cog. Command cog.
""" """
@ -94,8 +94,15 @@ class FeedCog(commands.Cog):
log.info("%s cog is ready", self.__class__.__name__) log.info("%s cog is ready", self.__class__.__name__)
@command(name="subscriptions") # Group for commands about viewing data
async def list_subscription(self, inter: Interaction): view_group = Group(
name="view",
description="View data.",
guild_only=True
)
@view_group.command(name="subscriptions")
async def cmd_list_subs(self, inter: Interaction):
"""List Subscriptions from this server.""" """List Subscriptions from this server."""
await inter.response.defer() await inter.response.defer()
@ -133,9 +140,19 @@ class FeedCog(commands.Cog):
initpage=1 initpage=1
) )
await pagination.send() await pagination.send()
# await Followup("results", str(await getdata(1, 10))).send(inter)
@command(name="test-channel-permissions") @view_group.command(name="tracked-content")
async def cmd_list_tracked(self, inter: Interaction):
"""List Tracked Content from this server, or a given sub"""
# Group for test related commands
test_group = Group(
name="test",
description="Commands to test Bot functionality.",
guild_only=True
)
@test_group.command(name="channel-permissions")
async def cmd_test_channel_perms(self, inter: Interaction): async def cmd_test_channel_perms(self, inter: Interaction):
"""Test that the current channel's permissions allow for PYRSS to operate in it.""" """Test that the current channel's permissions allow for PYRSS to operate in it."""
@ -174,9 +191,9 @@ class FeedCog(commands.Cog):
async def setup(bot): async def setup(bot):
""" """
Setup function for this extension. Setup function for this extension.
Adds `FeedCog` to the bot. Adds `CommandsCog` to the bot.
""" """
cog = FeedCog(bot) cog = CommandsCog(bot)
await bot.add_cog(cog) await bot.add_cog(cog)
log.info("Added %s cog", cog.__class__.__name__) log.info("Added %s cog", cog.__class__.__name__)