Added logs to some commands on crew

This commit is contained in:
Lucas Gabriel 2024-07-29 13:30:31 -03:00
parent e2e93ef35e
commit aa79bf3ceb
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
3 changed files with 19 additions and 1 deletions

View File

@ -63,11 +63,18 @@ module.exports = (bot) => {
const userId = ctx.from.id || Strings.unKnown; const userId = ctx.from.id || Strings.unKnown;
if (Config.admins.includes(userId)) { if (Config.admins.includes(userId)) {
const botName = ctx.message.text.split(' ').slice(1).join(' '); const botName = ctx.message.text.split(' ').slice(1).join(' ');
const botNameReport = Strings.botNameChanged.replace({botName}, botName);
ctx.telegram.setMyName(botName).catch(error => ctx.reply( ctx.telegram.setMyName(botName).catch(error => ctx.reply(
"Error when changing bot name:\n" + error, { "Error when changing bot name:\n" + error, {
reply_to_message_id: ctx.message.message_id reply_to_message_id: ctx.message.message_id
} }
)); ));
ctx.reply(
botNameReport, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
}
);
} else { } else {
ctx.reply(Strings.botAdminOnly, { ctx.reply(Strings.botAdminOnly, {
reply_to_message_id: ctx.message.message_id reply_to_message_id: ctx.message.message_id
@ -80,11 +87,18 @@ module.exports = (bot) => {
const userId = ctx.from.id || Strings.unKnown; const userId = ctx.from.id || Strings.unKnown;
if (Config.admins.includes(userId)) { if (Config.admins.includes(userId)) {
const botDesc = ctx.message.text.split(' ').slice(1).join(' '); 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, { "Error when changing bot description:\n" + error, {
reply_to_message_id: ctx.message.message_id reply_to_message_id: ctx.message.message_id
} }
)); ));
ctx.reply(
botDescReport, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
}
);
} else { } else {
ctx.reply( ctx.reply(
Strings.botAdminOnly, { Strings.botAdminOnly, {

View File

@ -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.", "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.", "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.", "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.", "invalidId": "Please enter a valid user ID.",
"banSuccess": "User with ID `{userId}` has been banned.", "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}", "banErr": "Could not ban the user. Please check if the ID is correct and if the bot has admin permissions.\n\n{tgErr}",

View File

@ -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.", "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.", "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.", "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.", "invalidId": "Por favor, insira um ID de usuário válido.",
"banSuccess": "Usuário com ID `{userId}` foi banido.", "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}`", "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}`",