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

chore: Add moderation module configuration commands

This commit is contained in:
wlinator 2024-08-03 14:41:23 -04:00
parent c94f7d0d5a
commit 0e962c8140
3 changed files with 53 additions and 28 deletions

View file

@ -26,6 +26,29 @@
"config_birthday_channel_set": "birthday announcements will be sent in {0}.",
"config_birthday_module_already_disabled": "the birthday module was already disabled.",
"config_birthday_module_disabled": "the birthday module was successfully disabled.",
"config_boost_channel_set": "boost announcements will be sent in {0}.",
"config_boost_image_field": "New Image URL:",
"config_boost_image_original": "Original (default)",
"config_boost_image_updated": "the boost image has been updated.",
"config_boost_module_already_disabled": "the boost module was already disabled.",
"config_boost_module_disabled": "the boost module was successfully disabled.",
"config_boost_template_field": "New Template:",
"config_boost_template_updated": "the boost message template has been updated.",
"config_example_next_footer": "An example will be sent next.",
"config_level_channel_set": "all level announcements will be sent in {0}.",
"config_level_current_channel_set": "members will receive level announcements in their current channel.",
"config_level_module_already_enabled": "the Lumi XP system was already enabled.",
"config_level_module_disabled": "the Lumi XP system was successfully disabled.",
"config_level_module_disabled_warning": "Warning: this module is disabled, please do '/config levels enable'",
"config_level_module_enabled": "the Lumi XP system was successfully enabled.",
"config_level_template": "Template:",
"config_level_template_updated": "the level template was successfully updated.",
"config_level_type_example": "Example:",
"config_level_type_generic": "level announcements will be **generic messages**.",
"config_level_type_generic_example": "📈 | **lucas** you have reached **Level 15**.",
"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_show_author": "{0} Configuration",
"config_show_birthdays": "Birthdays",
"config_show_boost_announcements": "Boost announcements",
@ -44,28 +67,6 @@
"config_welcome_module_disabled": "the greeting module was successfully disabled.",
"config_welcome_template_field": "New Template:",
"config_welcome_template_updated": "the welcome message template has been updated.",
"config_example_next_footer": "An example will be sent next.",
"config_boost_channel_set": "boost announcements will be sent in {0}.",
"config_boost_module_already_disabled": "the boost module was already disabled.",
"config_boost_module_disabled": "the boost module was successfully disabled.",
"config_boost_template_updated": "the boost message template has been updated.",
"config_boost_template_field": "New Template:",
"config_boost_image_updated": "the boost image has been updated.",
"config_boost_image_field": "New Image URL:",
"config_boost_image_original": "Original (default)",
"config_level_channel_set": "all level announcements will be sent in {0}.",
"config_level_current_channel_set": "members will receive level announcements in their current channel.",
"config_level_module_disabled": "the Lumi XP system was successfully disabled.",
"config_level_module_already_enabled": "the Lumi XP system was already enabled.",
"config_level_module_enabled": "the Lumi XP system was successfully enabled.",
"config_level_type_whimsical": "level announcements will be **sarcastic comments**.",
"config_level_type_generic": "level announcements will be **generic messages**.",
"config_level_type_example": "Example:",
"config_level_type_whimsical_example": "📈 | **lucas** Lol it took you this long to reach **Level 15**.",
"config_level_type_generic_example": "📈 | **lucas** you have reached **Level 15**.",
"config_level_template": "Template:",
"config_level_template_updated": "the level template was successfully updated.",
"config_level_module_disabled_warning": "Warning: this module is disabled, please do '/config levels enable'",
"daily_already_claimed_author": "Already Claimed",
"daily_already_claimed_description": "you can claim your daily reward again <t:{0}:R>.",
"daily_already_claimed_footer": "Daily reset is at 7 AM EST",
@ -81,10 +82,12 @@
"error_birthdays_disabled_author": "Birthdays Disabled",
"error_birthdays_disabled_description": "birthdays are disabled in this server.",
"error_birthdays_disabled_footer": "Contact a mod to enable them.",
"error_boost_image_url_invalid": "the image URL must end with `.jpg` or `.png`.",
"error_bot_missing_permissions_author": "Bot Missing Permissions",
"error_bot_missing_permissions_description": "Lumi lacks the required permissions to run this command.",
"error_command_cooldown_author": "Command Cooldown",
"error_command_cooldown_description": "try again in **{0:02d}:{1:02d}**.",
"error_image_url_invalid": "invalid image URL.",
"error_invalid_duration": "Invalid duration: {0}",
"error_invalid_duration_author": "Invalid Duration",
"error_invalid_duration_description": "Please provide a valid duration between 1 minute and 30 days.",
@ -176,7 +179,5 @@
"xp_lb_field_value": "level: **{0}**\nxp: `{1}/{2}`",
"xp_level": "Level {0}",
"xp_progress": "Progress to next level",
"xp_server_rank": "Server Rank: #{0}",
"error_image_url_invalid": "invalid image URL.",
"error_boost_image_url_invalid": "the image URL must end with `.jpg` or `.png`."
"xp_server_rank": "Server Rank: #{0}"
}

View file

@ -9,6 +9,7 @@ from modules.config import (
c_greet,
c_boost,
c_level,
c_moderation,
set_prefix,
xp_reward,
)
@ -78,7 +79,7 @@ class Config(commands.Cog):
CONFIG GROUPS
The 'config' group consists of many different configuration types, each being guild-specific and guild-only.
All commands in this group are exclusively available as slash-commands.
Only members with "manage guild" permissions can access commands in this group.
Only administrators can access commands in this group.
- Birthdays
- Welcome
@ -93,7 +94,7 @@ class Config(commands.Cog):
"config",
"server config commands.",
guild_only=True,
default_member_permissions=discord.Permissions(manage_guild=True),
default_member_permissions=discord.Permissions(administrator=True),
)
@config.command(name="show")
@ -102,7 +103,7 @@ class Config(commands.Cog):
birthday_config = config.create_subgroup(name="birthdays")
@config.command(name="birthdays")
@config.command(name="channel")
async def config_birthdays_channel(self, ctx, channel: discord.TextChannel):
await c_birthday.set_birthday_channel(ctx, channel)
@ -172,6 +173,12 @@ class Config(commands.Cog):
async def config_level_template(self, ctx, text: str):
await c_level.set_level_template(ctx, text)
modlog = config.create_subgroup(name="moderation")
@modlog.command(name="log")
async def config_moderation_log_channel(self, ctx, channel: discord.TextChannel):
await c_moderation.set_mod_log_channel(ctx, channel)
def setup(client):
client.add_cog(Config(client))

View file

@ -0,0 +1,17 @@
import discord
from lib.embed_builder import EmbedBuilder
from lib.constants import CONST
from services.moderation.modlog_service import ModLogService
async def set_mod_log_channel(ctx, channel: discord.TextChannel):
mod_log = ModLogService()
mod_log.set_modlog_channel(ctx.guild.id, channel.id)
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)