From aa79bf3ceb0794d8ff08438d3a2fa9b230173c73 Mon Sep 17 00:00:00 2001 From: lucmsilva651 Date: Mon, 29 Jul 2024 13:30:31 -0300 Subject: [PATCH] Added logs to some commands on crew --- commands/crew.js | 16 +++++++++++++++- locales/english.json | 2 ++ locales/portuguese.json | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/commands/crew.js b/commands/crew.js index 0ec5d5b..27aa6c2 100644 --- a/commands/crew.js +++ b/commands/crew.js @@ -63,11 +63,18 @@ module.exports = (bot) => { const userId = ctx.from.id || Strings.unKnown; if (Config.admins.includes(userId)) { const botName = ctx.message.text.split(' ').slice(1).join(' '); + const botNameReport = Strings.botNameChanged.replace({botName}, botName); ctx.telegram.setMyName(botName).catch(error => ctx.reply( "Error when changing bot name:\n" + error, { reply_to_message_id: ctx.message.message_id } )); + ctx.reply( + botNameReport, { + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + } + ); } else { ctx.reply(Strings.botAdminOnly, { reply_to_message_id: ctx.message.message_id @@ -80,11 +87,18 @@ module.exports = (bot) => { const userId = ctx.from.id || Strings.unKnown; if (Config.admins.includes(userId)) { const botDesc = ctx.message.text.split(' ').slice(1).join(' '); - ctx.telegram.setMyName(botDesc).catch(error => ctx.reply( + const botDescReport = Strings.botDescChanged.replace({botDesc}, botDesc); + ctx.telegram.setMyDescription(botDesc).catch(error => ctx.reply( "Error when changing bot description:\n" + error, { reply_to_message_id: ctx.message.message_id } )); + ctx.reply( + botDescReport, { + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + } + ); } else { ctx.reply( Strings.botAdminOnly, { diff --git a/locales/english.json b/locales/english.json index 2f838b3..42ea7d3 100644 --- a/locales/english.json +++ b/locales/english.json @@ -10,6 +10,8 @@ "botAdminOnly": "This command is exclusive to the bot's general administrators. I can't disclose who they are, nor what this command does.", "privateOnly": "This command should be used only on private chats, and not on groups.", "groupOnly": "This command should be used only on groups, and not on private chats.", + "botNameChanged": "*Bot name changed to* `{botName}`", + "botDescChanged": "*Bot description changed to* `{botDesc}`", "invalidId": "Please enter a valid user ID.", "banSuccess": "User with ID `{userId}` has been banned.", "banErr": "Could not ban the user. Please check if the ID is correct and if the bot has admin permissions.\n\n{tgErr}", diff --git a/locales/portuguese.json b/locales/portuguese.json index 9c2474c..903ac8d 100644 --- a/locales/portuguese.json +++ b/locales/portuguese.json @@ -10,6 +10,8 @@ "botAdminOnly": "Esse comando é exclusivo a administradores gerais do bot. Não posso informar quem são, e nem o que esse comando faz.", "privateOnly": "Esse comando deve ser utilizado apenas em chats privados, e não em grupos.", "groupOnly": "Esse comando deve ser utilizado apenas em grupos, e não em chats privados.", + "botNameChanged": "*Nome do bot alterado para* `{botName}`", + "botDescChanged": "*Descrição do bot alterada para* `{botDesc}`", "invalidId": "Por favor, insira um ID de usuário válido.", "banSuccess": "Usuário com ID `{userId}` foi banido.", "banErr": "Não foi possível banir o usuário. Verifique se o ID está correto e se o bot tem permissões de administrador.\n\n`{tgErr}`",