2024-01-13 10:44:08 -05:00
from redbot . core import commands
from redbot . core . utils . chat_formatting import error , warning
from . embed import embed
from . . abc import Mixin
from . . importers . aurora import ImportAuroraView
from . . importers . galacticbot import ImportGalacticBotView
class Configuration ( Mixin ) :
""" Configuration commands for Aurora. """
2024-01-15 01:46:12 -05:00
@commands.group ( autohelp = True , aliases = [ ' moderation ' , ' mod ' ] )
async def aurora ( self , ctx : commands . Context ) :
""" Settings and miscellaneous commands for Aurora. """
2024-01-13 10:44:08 -05:00
2024-01-15 01:46:12 -05:00
@aurora.command ( name = " settings " , aliases = [ ' config ' , ' options ' , ' set ' ] )
async def aurora_settings ( self , ctx : commands . Context ) :
""" View Aurora configuration settings. """
await ctx . send ( embed = await embed ( ctx ) )
@aurora.group ( autohelp = True , name = ' import ' )
2024-01-13 10:44:08 -05:00
@commands.admin ( )
@commands.guild_only ( )
2024-01-15 01:46:12 -05:00
async def aurora_import ( self , ctx : commands . Context ) :
2024-01-13 10:44:08 -05:00
""" Import moderations from other bots. """
2024-01-15 01:46:12 -05:00
@aurora_import.command ( name = " aurora " )
2024-01-13 10:44:08 -05:00
@commands.admin ( )
2024-01-15 06:49:20 -05:00
async def aurora_import_aurora ( self , ctx : commands . Context ) :
2024-01-13 10:44:08 -05:00
""" Import moderations from another bot using Aurora. """
if ctx . message . attachments and ctx . message . attachments [ 0 ] . content_type == ' application/json; charset=utf-8 ' :
message = await ctx . send ( warning ( " Are you sure you want to import moderations from another bot? \n **This will overwrite any moderations that already exist in this guild ' s moderation table.** \n *The import process will block the rest of your bot until it is complete.* " ) )
await message . edit ( view = ImportAuroraView ( 60 , ctx , message ) )
else :
await ctx . send ( error ( " Please provide a valid Aurora export file. " ) )
2024-01-15 01:46:12 -05:00
@aurora_import.command ( name = " galacticbot " )
2024-01-13 10:44:08 -05:00
@commands.admin ( )
2024-01-15 06:49:20 -05:00
async def aurora_import_galacticbot ( self , ctx : commands . Context ) :
2024-01-13 10:44:08 -05:00
""" Import moderations from GalacticBot. """
if ctx . message . attachments and ctx . message . attachments [ 0 ] . content_type == ' application/json; charset=utf-8 ' :
message = await ctx . send ( warning ( " Are you sure you want to import GalacticBot moderations? \n **This will overwrite any moderations that already exist in this guild ' s moderation table.** \n *The import process will block the rest of your bot until it is complete.* " ) )
await message . edit ( view = ImportGalacticBotView ( 60 , ctx , message ) )
else :
await ctx . send ( error ( " Please provide a valid GalacticBot moderation export file. " ) )