SeaCogs/aurora/configuration/commands.py

43 lines
2.3 KiB
Python
Raw Normal View History

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."""
@commands.guild_only()
@commands.group(autohelp=True, aliases=['moderationset', 'modset', 'moderationsettings', 'aurorasettings', 'auroraconfig'])
async def auroraset(self, ctx: commands.Context):
"""Set Aurora configuration options."""
await ctx.reply(embed=embed(ctx))
@auroraset.group(autohelp=True, name='import')
@commands.admin()
@commands.guild_only()
async def auroraset_import(self, ctx: commands.Context):
"""Import moderations from other bots."""
@auroraset_import.command(name="aurora")
@commands.admin()
async def auroraset_import_aurora(self, ctx: commands.Context):
"""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."))
@auroraset_import.command(name="galacticbot")
@commands.admin()
async def auroraset_import_galacticbot(self, ctx: commands.Context):
"""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."))