forked from cswimr/SeaCogs
feat(art): introduced art cog
This commit is contained in:
parent
fa30a79b06
commit
48cd63c5d4
3 changed files with 83 additions and 0 deletions
5
art/__init__.py
Normal file
5
art/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from .art import Art
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(Art(bot))
|
68
art/art.py
Normal file
68
art/art.py
Normal file
|
@ -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}")
|
10
art/info.json
Normal file
10
art/info.json
Normal file
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue