Formatted everything with black
This commit is contained in:
@@ -1,35 +1,90 @@
|
||||
from discord import ApplicationContext, Option, SlashCommandGroup, CategoryChannel
|
||||
from discord.ext import commands
|
||||
from functions import getMsg, guildConfGet, guildConfReset, guildConfSet, loadJson, makeEmbed, strToColor
|
||||
from functions import (
|
||||
getMsg,
|
||||
guildConfGet,
|
||||
guildConfReset,
|
||||
guildConfSet,
|
||||
loadJson,
|
||||
makeEmbed,
|
||||
strToColor,
|
||||
)
|
||||
|
||||
#=========================================================================================================================
|
||||
|
||||
# =========================================================================================================================
|
||||
class CogCategory(commands.Cog):
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
category = SlashCommandGroup("category", "Commands related to parent channels category")
|
||||
category = SlashCommandGroup(
|
||||
"category", "Commands related to parent channels category"
|
||||
)
|
||||
|
||||
@category.command(name="set", description="Select the voice channel that will be parent to private ones")
|
||||
async def category_set(self, ctx: ApplicationContext, category: Option(CategoryChannel, "Parent Channel Category")): # type: ignore
|
||||
@category.command(
|
||||
name="set",
|
||||
description="Select the voice channel that will be parent to private ones",
|
||||
)
|
||||
async def category_set(self, ctx: ApplicationContext, category: Option(CategoryChannel, "Parent Channel Category")): # type: ignore
|
||||
config = loadJson("config.json")
|
||||
if ctx.guild is not None:
|
||||
guildConfSet(ctx.guild, "category", category.id)
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("set_category_title", ctx.guild), description=getMsg("set_category_description", ctx.guild).format(category.name), color=strToColor(config["color_ok"])))
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("set_category_title", ctx.guild),
|
||||
description=getMsg("set_category_description", ctx.guild).format(
|
||||
category.name
|
||||
),
|
||||
color=strToColor(config["color_ok"]),
|
||||
)
|
||||
)
|
||||
if guildConfGet(ctx.guild, "channel") is None:
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("hint_none_channel_title", ctx.guild), description=getMsg("hint_none_channel_description", ctx.guild), color=strToColor(config["color_warn"])))
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("hint_none_channel_title", ctx.guild),
|
||||
description=getMsg("hint_none_channel_description", ctx.guild),
|
||||
color=strToColor(config["color_warn"]),
|
||||
)
|
||||
)
|
||||
else:
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("dm_title", ctx.guild), description=getMsg("dm_description", ctx.guild), color=strToColor(config["color_error"])))
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("dm_title", ctx.guild),
|
||||
description=getMsg("dm_description", ctx.guild),
|
||||
color=strToColor(config["color_error"]),
|
||||
)
|
||||
)
|
||||
|
||||
@category.command(name="reset", description="Reset the currently selected parent channel category")
|
||||
async def category_reset(self, ctx: ApplicationContext): # type: ignore
|
||||
@category.command(
|
||||
name="reset", description="Reset the currently selected parent channel category"
|
||||
)
|
||||
async def category_reset(self, ctx: ApplicationContext): # type: ignore
|
||||
config = loadJson("config.json")
|
||||
if ctx.guild is not None:
|
||||
if guildConfGet(ctx.guild, "category") is not None:
|
||||
guildConfReset(ctx.guild, "category")
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("reset_category_title", ctx.guild), description=getMsg("reset_category_description", ctx.guild), color=strToColor(config["color_ok"])))
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("reset_category_title", ctx.guild),
|
||||
description=getMsg("reset_category_description", ctx.guild),
|
||||
color=strToColor(config["color_ok"]),
|
||||
)
|
||||
)
|
||||
else:
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("hint_none_category_title", ctx.guild), description=getMsg("hint_none_category_description", ctx.guild), color=strToColor(config["color_warn"])))
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("hint_none_category_title", ctx.guild),
|
||||
description=getMsg("hint_none_category_description", ctx.guild),
|
||||
color=strToColor(config["color_warn"]),
|
||||
)
|
||||
)
|
||||
else:
|
||||
await ctx.respond(embed=makeEmbed(title=getMsg("dm_title", ctx.guild), description=getMsg("dm_description", ctx.guild), color=strToColor(config["color_error"])))
|
||||
#=========================================================================================================================
|
||||
await ctx.respond(
|
||||
embed=makeEmbed(
|
||||
title=getMsg("dm_title", ctx.guild),
|
||||
description=getMsg("dm_description", ctx.guild),
|
||||
color=strToColor(config["color_error"]),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# =========================================================================================================================
|
||||
|
Reference in New Issue
Block a user