diff --git a/handlers/commands/removeCommand.js b/handlers/commands/removeCommand.js index 9f55546..7f98f14 100644 --- a/handlers/commands/removeCommand.js +++ b/handlers/commands/removeCommand.js @@ -26,7 +26,7 @@ const removeCommandHandler = async ({ chat, message, reply, state }) => { ); } - const command = await getCommand({ name: commandName }); + const command = await getCommand({ name: commandName.toLowerCase() }); if (!command) { return reply( 'ℹ️ Command couldn\'t be found.', @@ -42,7 +42,7 @@ const removeCommandHandler = async ({ chat, message, reply, state }) => { ); } - await removeCommand({ name: commandName }); + await removeCommand({ name: commandName.toLowerCase() }); return reply( `✅ !${commandName} ` + 'has been removed successfully.', diff --git a/handlers/messages/addCustomCmd.js b/handlers/messages/addCustomCmd.js index 1d0deec..1dece4f 100644 --- a/handlers/messages/addCustomCmd.js +++ b/handlers/messages/addCustomCmd.js @@ -45,7 +45,7 @@ const addCustomCmdHandler = async ({ chat, message, reply, state }, next) => { return next(); } - if (await getCommand({ isActive: true, name: text })) { + if (await getCommand({ isActive: true, name: text.toLowerCase() })) { reply( 'ℹ️ This command already exists.\n\n' + '/commands - to see the list of commands.\n' + @@ -56,7 +56,7 @@ const addCustomCmdHandler = async ({ chat, message, reply, state }, next) => { ); return next(); } - await updateCommand({ id, name: text, state: 'role' }); + await updateCommand({ id, name: text.toLowerCase(), state: 'role' }); reply('Who can use this command?', Markup.keyboard([ [ 'Master', 'Admins', 'Everyone' ] ]) diff --git a/handlers/messages/runCustomCmd.js b/handlers/messages/runCustomCmd.js index 92107f4..db49e29 100644 --- a/handlers/messages/runCustomCmd.js +++ b/handlers/messages/runCustomCmd.js @@ -11,7 +11,10 @@ const runCustomCmdHandler = async (ctx, next) => { return next(); } - const commandName = message.text.split(' ')[0].replace('!', ''); + const commandName = message.text + .split(' ')[0] + .replace('!', '') + .toLowerCase(); const command = await getCommand({ isActive: true, name: commandName }); if (!command) {