cogs/theme/management.py
async def import_colors(self, ctx, *, name):
        """Save a preset as a theme."""
        themes = db.get(ctx.guild.id, "themes")

        if len(themes) >= cfg.theme_limit:
            raise CommandError(f"Theme Limit Reached ({len(themes)}/10)")

        # Read in preset as dict
        name = name.replace(" ", "")
        try:
            with open(f"assets{sep}presets{sep}{name.lower()}.json") as preset_data:
                preset = json.load(preset_data)
        except FileNotFoundError:
            raise UserInputError("Could not find that preset")

        db.guilds.update_one(
            {"_id": ctx.guild.id},
            {"$push": {"themes": preset}}
        )

        if ctx.guild.id not in cfg.suppress_output:
            await ctx.invoke(self.bot.get_command("themes"))
Save a preset as a theme.
Save a preset as a theme.
Save a preset as a theme .
async def import_colors(self, ctx, *, name):
        themes = db.get(ctx.guild.id, "themes")
        if len(themes) >= cfg.theme_limit:
            raise CommandError(f"Theme Limit Reached ({len(themes)}/10)")
        name = name.replace(" ", "")
        try:
            with open(f"assets{sep}presets{sep}{name.lower()}.json") as preset_data:
                preset = json.load(preset_data)
        except FileNotFoundError:
            raise UserInputError("Could not find that preset")
        db.guilds.update_one(
            {"_id": ctx.guild.id},
            {"$push": {"themes": preset}}
        )
        if ctx.guild.id not in cfg.suppress_output:
            await ctx.invoke(self.bot.get_command("themes"))
async def import_colors ( self , ctx , * , name ) : themes = db . get ( ctx . guild . id , "themes" ) if len ( themes ) >= cfg . theme_limit : raise CommandError ( f"Theme Limit Reached ({len(themes)}/10)" ) name = name . replace ( " " , "" ) try : with open ( f"assets{sep}presets{sep}{name.lower()}.json" ) as preset_data : preset = json . load ( preset_data ) except FileNotFoundError : raise UserInputError ( "Could not find that preset" ) db . guilds . update_one ( { "_id" : ctx . guild . id } , { "$push" : { "themes" : preset } } ) if ctx . guild . id not in cfg . suppress_output : await ctx . invoke ( self . bot . get_command ( "themes" ) )
Save a preset as a theme.
Save a preset as a theme .
"""Save a preset as a theme.""" # Read in preset as dict
self
ctx
name