From 48cd63c5d4c124451fda5cea03da83ea3913a114 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 28 Dec 2023 10:00:14 -0500 Subject: [PATCH] feat(art): introduced art cog --- art/__init__.py | 5 ++++ art/art.py | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ art/info.json | 10 ++++++++ 3 files changed, 83 insertions(+) create mode 100644 art/__init__.py create mode 100644 art/art.py create mode 100644 art/info.json diff --git a/art/__init__.py b/art/__init__.py new file mode 100644 index 0000000..3705628 --- /dev/null +++ b/art/__init__.py @@ -0,0 +1,5 @@ +from .art import Art + + +async def setup(bot): + await bot.add_cog(Art(bot)) diff --git a/art/art.py b/art/art.py new file mode 100644 index 0000000..1e669d0 --- /dev/null +++ b/art/art.py @@ -0,0 +1,68 @@ +# _____ _ +# / ____| (_) +# | (___ ___ __ _ _____ ___ _ __ ___ _ __ ___ ___ _ __ +# \___ \ / _ \/ _` / __\ \ /\ / / | '_ ` _ \| '_ ` _ \ / _ \ '__| +# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ | +# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_| + +import discord +from redbot.core import app_commands, config, checks, commands, data_manager +from redbot.core.app_commands import Choice + + +class Art(commands.Cog): + """TODO.""" + + __author__ = "SeaswimmerTheFsh" + __version__ = "0.1.0" + + def __init__(self, bot): + self.bot = bot + self.config = config.Config.get_conf( + self, identifier=2347831296542324 + ) + self.config.register_guild( + art_channel=None, + art_submission_channel=None + ) + + @app_commands.command() + async def art(self, interaction: discord.Interaction, art: discord.Attachment): + """Submit art. + + Parameters + ----------- + art: discord.Attachment + Upload your art submission here. + """ + await interaction.response.defer(ephemeral=True) + art_submission_channel = interaction.guild.get_channel(await self.config.guild(interaction.guild).art_submission_channel()) + if art_submission_channel is None: + await interaction.followup.send("Art submission channel not set. Report this error to the server administrators.", ephemeral=True) + return + await art_submission_channel.send(f"Art submission from {interaction.user.mention} ({interaction.user.id}):", files=art) + await interaction.followup.send("Art submitted.", ephemeral=True) + + @commands.group() + @checks.admin_or_permissions(manage_guild=True) + async def artset(self, ctx: commands.Context): + """Art submission settings.""" + + @artset.command() + async def channel(self, ctx: commands.Context, channel: discord.TextChannel): + """Set the art submission channel.""" + await self.config.guild(ctx.guild).art_submission_channel.set(channel.id) + await ctx.send(f"Art submission channel set to {channel.mention}.") + + @artset.command() + async def artchannel(self, ctx: commands.Context, channel: discord.TextChannel): + """Set the art channel.""" + await self.config.guild(ctx.guild).art_channel.set(channel.id) + await ctx.send(f"Art channel set to {channel.mention}.") + + @artset.command() + async def list(self, ctx: commands.Context): + """List all settings.""" + art_channel = ctx.guild.get_channel(await self.config.guild(ctx.guild).art_channel()) + art_submission_channel = ctx.guild.get_channel(await self.config.guild(ctx.guild).art_submission_channel()) + await ctx.send(f"Art channel: {art_channel.mention}\nArt submission channel: {art_submission_channel.mention}") diff --git a/art/info.json b/art/info.json new file mode 100644 index 0000000..f6c23db --- /dev/null +++ b/art/info.json @@ -0,0 +1,10 @@ +{ + "author" : ["SeaswimmerTheFsh"], + "install_msg" : "Thank you for installing Art!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).", + "name" : "Art", + "short" : "TODO", + "description" : "TODO", + "end_user_data_statement" : "This cog does not store end user data.", + "hidden": false, + "disabled": false + }