diff --git a/tux/cogs/guild/roles.py b/tux/cogs/guild/roles.py new file mode 100644 index 0000000..5609ce7 --- /dev/null +++ b/tux/cogs/guild/roles.py @@ -0,0 +1,22 @@ +import discord +from discord import app_commands +from discord.ext import commands +from loguru import logger + + +class Roles(commands.Cog): + def __init__(self, bot: commands.Bot) -> None: + self.bot = bot + + group = app_commands.Group(name="roles", description="Role commands.") + + @group.command(name="create", description="Creates a role in the guild.") + async def create(self, interaction: discord.Interaction, name: str) -> None: + if interaction.guild is not None: + role = await interaction.guild.create_role(name=name) + await interaction.response.send_message(f"Created role {role.name}.") + logger.info(f"{interaction.user} created role {role.name}.") + + +async def setup(bot: commands.Bot) -> None: + await bot.add_cog(Roles(bot))