Implemented basic guild config, improved PycordUser and PycordGuild, fixed PycordBut, added stubs for events

This commit is contained in:
2025-04-18 18:17:35 +02:00
parent 691dd1c958
commit f7fd81f299
5 changed files with 297 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
from discord import SlashCommandGroup, option, ApplicationContext, Attachment
from discord.ext.commands import Cog
from classes import PycordGuild
from classes.pycord_bot import PycordBot
@@ -9,6 +11,68 @@ class Event(Cog):
def __init__(self, bot: PycordBot):
self.bot: PycordBot = bot
# TODO Introduce i18n
command_group: SlashCommandGroup = SlashCommandGroup("event", "Event management")
# TODO Implement the command
@command_group.command(
name="create",
description="Create new event",
)
@option("name", description="Name of the event", required=True)
@option("start", description="Date when the event starts (DD.MM.YYYY)", required=True)
@option("finish", description="Date when the event finishes (DD.MM.YYYY)", required=True)
@option("thumbnail", description="Thumbnail of the event", required=False)
async def command_event_create(
self,
ctx: ApplicationContext,
name: str,
start: str,
finish: str,
thumbnail: Attachment = None,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
# TODO Implement the command
@command_group.command(
name="edit",
description="Edit event",
)
@option("event", description="Name of the event", required=True)
@option("name", description="New name of the event", required=False)
@option("start", description="Date when the event starts (DD.MM.YYYY)", required=False)
@option("finish", description="Date when the event finishes (DD.MM.YYYY)", required=False)
@option("thumbnail", description="Thumbnail of the event", required=False)
async def command_event_edit(
self,
ctx: ApplicationContext,
event: str,
name: str,
start: str,
finish: str,
thumbnail: Attachment = None,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
# TODO Implement the command
@command_group.command(
name="cancel",
description="Cancel event",
)
@option("name", description="Name of the event", required=True)
async def command_event_cancel(
self,
ctx: ApplicationContext,
name: str,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
def setup(bot: PycordBot) -> None:
bot.add_cog(Event(bot))