2023-12-28 10:00:14 -05:00
# _____ _
# / ____| (_)
# | (___ ___ __ _ _____ ___ _ __ ___ _ __ ___ ___ _ __
# \___ \ / _ \/ _` / __\ \ /\ / / | '_ ` _ \| '_ ` _ \ / _ \ '__|
# ____) | __/ (_| \__ \\ 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
2023-12-28 10:07:50 -05:00
await art_submission_channel . send ( f " Art submission from { interaction . user . mention } ( { interaction . user . id } ): " , file = await art . to_file ( filename = str ( interaction . user . id ) ) )
2023-12-28 10:00:14 -05:00
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 ( ) )
2023-12-28 10:03:18 -05:00
if art_channel :
response_str = f " Art channel: { art_channel . mention } \n "
else :
response_str = " Art channel not set. \n "
if art_submission_channel :
response_str + = f " Art submission channel: { art_submission_channel . mention } "
else :
response_str + = " Art submission channel not set. "
2023-12-28 10:04:06 -05:00
await ctx . send ( response_str )