Send a message when the values are changed

This commit is contained in:
JKuijperM 2025-06-23 11:34:28 +02:00
parent 47d8195465
commit 5841c4a4a6

15
bot.py
View File

@ -140,22 +140,29 @@ class Bot(commands.Bot):
@commands.command(name='config')
async def modify_config(self, ctx):
# TODO: Check if user is the streamer or mod
# Check if user is the streamer or mod
# Get the values from the message
if ctx.author.name.lower() == ctx.channel.name.lower() or ctx.author.badges == 'moderator':
print('[OK] Correct credentials to modify the config.')
print('{}'.format(ctx.message.content))
config_message = ctx.message.content.replace('\U000e0000', '').split()
print(config_message)
config_message = ctx.message.content.replace('\U000e0000', '').split()
if len(config_message) == 3:
if config_message[1] == 'water':
self.default_values['water_limit'] = int(config_message[2])
save_config_file(self.default_values)
print(' - Water limit message modified to: {}'.format(config_message[2]))
elif config_message[1] == 'prime':
self.default_values['prime_spam_limit'] = int(config_message[2])
save_config_file(self.default_values)
print(' - Prime limit message modified to: {}'.format(config_message[2]))
await ctx.channel.send('Veeenga, modifico el número de mensajes que me pides.')
else:
await ctx.channel.send('@{} Jefe, faltan parámetros para la configuración.'.format(ctx.author.display_name))
else:
await ctx.channel.send('@{} Lo siento, pero tú no tienes poder aquí. Pídeselo a algún moderador o @jkuijperm'.format(ctx.author.display_name))