1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:23:12 +00:00

Merge pull request #22 from wlinator/moderation

chore: Update mod-log channel configuration and add info embed
This commit is contained in:
wlinator 2024-08-04 13:53:48 -04:00
commit f877d227db
2 changed files with 35 additions and 2 deletions

View file

@ -49,6 +49,13 @@
"config_level_type_whimsical": "level announcements will be **sarcastic comments**.",
"config_level_type_whimsical_example": "📈 | **lucas** Lol it took you this long to reach **Level 15**.",
"config_modlog_channel_set": "moderation logs will be sent in {0}.",
"config_modlog_info_author": "Moderation Log Configuration",
"config_modlog_info_commands_name": "📖 Case commands",
"config_modlog_info_commands_value": "`/cases` - View all cases in this server\n`/case <case_id>` - View a specific case\n`/editcase <case_id> <new_reason>` - Update a case reason",
"config_modlog_info_description": "This channel has been set as the moderation log channel for **{0}**. All moderation actions issued with Lumi will be logged here as cases.",
"config_modlog_info_warning_name": "⚠️ Warning",
"config_modlog_info_warning_value": "Changing the mod-log channel in the future will make old cases uneditable in this channel.",
"config_modlog_permission_error": "I don't have perms to send messages in that channel. Please fix & try again.",
"config_prefix_get": "the current prefix for this server is `{0}`.",
"config_prefix_set": "the prefix has been set to `{0}`.",
"config_prefix_too_long": "the prefix must be 25 characters or less.",

View file

@ -2,16 +2,42 @@ import discord
from lib.embed_builder import EmbedBuilder
from lib.constants import CONST
from services.moderation.modlog_service import ModLogService
from lib.exceptions.LumiExceptions import LumiException
async def set_mod_log_channel(ctx, channel: discord.TextChannel):
mod_log = ModLogService()
info_embed = EmbedBuilder().create_success_embed(
ctx=ctx,
author_text=CONST.STRINGS["config_modlog_info_author"],
description=CONST.STRINGS["config_modlog_info_description"].format(
ctx.guild.name,
),
show_name=False,
)
info_embed.add_field(
name=CONST.STRINGS["config_modlog_info_commands_name"],
value=CONST.STRINGS["config_modlog_info_commands_value"],
inline=False,
)
info_embed.add_field(
name=CONST.STRINGS["config_modlog_info_warning_name"],
value=CONST.STRINGS["config_modlog_info_warning_value"],
inline=False,
)
try:
await channel.send(embed=info_embed)
except discord.errors.Forbidden as e:
raise LumiException(CONST.STRINGS["config_modlog_permission_error"]) from e
mod_log.set_modlog_channel(ctx.guild.id, channel.id)
embed = EmbedBuilder().create_success_embed(
success_embed = EmbedBuilder().create_success_embed(
ctx=ctx,
author_text=CONST.STRINGS["config_author"],
description=CONST.STRINGS["config_modlog_channel_set"].format(channel.mention),
)
return await ctx.respond(embed=embed)
return await ctx.respond(embed=success_embed)