mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 13:17:56 +00:00
Custom commands now start with !
This commit is contained in:
parent
70b28b7b53
commit
e8d682d527
@ -6,13 +6,12 @@ const { getCommand } = require('../../stores/command');
|
||||
const runCustomCmdHandler = async (ctx, next) => {
|
||||
const { message, state } = ctx;
|
||||
const { isAdmin, isMaster } = state;
|
||||
const isCommand = message.entities &&
|
||||
message.entities.filter(entity => entity.type === 'bot_command');
|
||||
if (!isCommand || !isCommand.length) {
|
||||
const isCommand = /^!\w+/.test(message.text);
|
||||
if (!isCommand) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const commandName = message.text.split(' ')[0].replace('/', '');
|
||||
const commandName = message.text.split(' ')[0].replace('!', '');
|
||||
const command = await getCommand({ isActive: true, name: commandName });
|
||||
|
||||
if (!command) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user