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

Finetune config command

This commit is contained in:
wlinator 2024-03-19 10:05:43 +01:00
parent ef97be68ab
commit c3a7414d64
2 changed files with 29 additions and 29 deletions

View file

@ -194,6 +194,7 @@ class Config(commands.Cog):
else: else:
guild_config.welcome_channel_id = None guild_config.welcome_channel_id = None
guild_config.welcome_message = None
guild_config.push() guild_config.push()
embed.description = "✅ | The greeting module was successfully disabled." embed.description = "✅ | The greeting module was successfully disabled."
return await ctx.respond(embed=embed) return await ctx.respond(embed=embed)

View file

@ -1,5 +1,6 @@
import discord import discord
from services.GuildConfig import GuildConfig from services.GuildConfig import GuildConfig
from main import strings
async def cmd(ctx): async def cmd(ctx):
@ -14,74 +15,72 @@ async def cmd(ctx):
if guild_config.birthday_channel_id: if guild_config.birthday_channel_id:
try: try:
channel = ctx.guild.get_channel(guild_config.birthday_channel_id) channel = ctx.guild.get_channel(guild_config.birthday_channel_id)
birthday_config = f"Birthday announcements will be sent in {channel.mention}." birthday_config = f"✅ | in {channel.mention}."
except discord.HTTPException: except discord.HTTPException:
birthday_config = f"The birthday channel seems to be invalid. Set it with `/config birthdays channel`." birthday_config = f"❌ | enable the module with `/config birthdays channel`"
else: else:
birthday_config = f"Birthdays are disabled, configure them with `/config birthdays channel`" birthday_config = f"❌ | enable the module with `/config birthdays channel`"
embed.add_field(name="🎂 Birthdays", value=birthday_config, inline=False)
embed.add_field(name="BIRTHDAYS", value=birthday_config, inline=False)
# commands # commands
if guild_config.command_channel_id: if guild_config.command_channel_id:
try: try:
channel = ctx.guild.get_channel(guild_config.command_channel_id) channel = ctx.guild.get_channel(guild_config.command_channel_id)
commands_config = f"XP and economy commands can only be used in {channel.mention}." commands_config = f"✅ | commands only allowed in {channel.mention}."
except discord.HTTPException: except discord.HTTPException:
commands_config = f"Commands can be used anywhere in the server." commands_config = f"✅ | Commands allowed anywhere."
else: else:
commands_config = f"Commands can be used anywhere in the server." commands_config = f"✅ | Commands allowed anywhere."
embed.add_field(name="🤖 Commands", value=commands_config, inline=False) embed.add_field(name="COMMANDS", value=commands_config, inline=False)
# greetings # greetings
if guild_config.welcome_channel_id: if guild_config.welcome_channel_id:
try: try:
channel = ctx.guild.get_channel(guild_config.welcome_channel_id) channel = ctx.guild.get_channel(guild_config.welcome_channel_id)
greeting_config = f"Welcome messages will be sent in {channel.mention}" greeting_config = f"✅ | in {channel.mention}"
except discord.HTTPException:
greeting_config = f"The greeting channel seems to be invalid. Set it with `/config greetings channel`."
else:
greeting_config = f"Greetings are disabled, configure them with `/config greetings channel`"
if guild_config.welcome_message: if guild_config.welcome_message:
greeting_config += f"\nTemplate:\n```{guild_config.welcome_message}```" greeting_config += f" with template:\n```{guild_config.welcome_message}```"
else:
greeting_config += f" without custom template."
embed.add_field(name="👋 Greetings", value=greeting_config, inline=False) except discord.HTTPException:
greeting_config = f"❌ | enable the module with `/config greetings channel`"
else:
greeting_config = f"❌ | enable the module with `/config greetings channel`"
embed.add_field(name="GREETINGS", value=greeting_config, inline=False)
# levels # levels
if guild_config.level_message_type == 0: if guild_config.level_message_type == 0:
level_config = f"Levels are disabled in this server. Enable them with `/config levels enable`" level_config = f"❌ | enable levels with `/config levels enable`"
elif guild_config.level_message_type == 1: elif guild_config.level_message_type == 1:
level_config = f"levels are enabled and Racu will announce levels with __whimsical remarks__." level_config = f"✅ | whimsical/sarcastic announcements"
else: else:
level_config = f"levels are enabled and Racu will announce levels with a __generic message__." level_config = f"✅ | generic announcements"
if guild_config.level_channel_id and guild_config.level_message_type != 0: if guild_config.level_channel_id and guild_config.level_message_type != 0:
try: try:
channel = ctx.guild.get_channel(guild_config.level_channel_id) channel = ctx.guild.get_channel(guild_config.level_channel_id)
level_config += f"\nLevel announcements will always be sent in {channel.mention}." level_config += f" in {channel.mention}"
except discord.HTTPException: except discord.HTTPException:
level_config += f"\nAnnouncements will be sent in the channel where the user levels up." level_config += f" in the user's current channel"
else: else:
if guild_config.level_message_type != 0: if guild_config.level_message_type != 0:
level_config += f"\nAnnouncements will be sent in the channel where the user levels up." level_config += f" in the user's current channel"
if guild_config.level_message and guild_config.level_message_type == 2: if guild_config.level_message and guild_config.level_message_type == 2:
level_config += f"\nTemplate:\n```{guild_config.level_message}```" level_config += f" with template:\n```{guild_config.level_message}```"
if not guild_config.level_message and guild_config.level_message_type == 2:
level_config += f" with template:\n```{strings['level_up']}```"
embed.add_field(name="📈 Levels", value=level_config, inline=False) embed.add_field(name="LEVELS", value=level_config, inline=False)
await ctx.respond(embed=embed) await ctx.respond(embed=embed)