mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 21:27:47 +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 runCustomCmdHandler = async (ctx, next) => {
|
||||||
const { message, state } = ctx;
|
const { message, state } = ctx;
|
||||||
const { isAdmin, isMaster } = state;
|
const { isAdmin, isMaster } = state;
|
||||||
const isCommand = message.entities &&
|
const isCommand = /^!\w+/.test(message.text);
|
||||||
message.entities.filter(entity => entity.type === 'bot_command');
|
if (!isCommand) {
|
||||||
if (!isCommand || !isCommand.length) {
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
const commandName = message.text.split(' ')[0].replace('/', '');
|
const commandName = message.text.split(' ')[0].replace('!', '');
|
||||||
const command = await getCommand({ isActive: true, name: commandName });
|
const command = await getCommand({ isActive: true, name: commandName });
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user