-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
i'm trying to make an autoresponse with my bot and trying to use conditional commands to know whether the command is enabled or disabled. here is the code that i have for it:
const { Command } = require('discord-akairo');
const typeorm = require('typeorm');
class ReeCommand extends Command {
constructor() {
super('ree', {
regex: /^ree+$/i,
typing: true,
cooldown: 25000,
});
}
async condition(message) {
const connection = typeorm.getConnection();
const getStatus = await connection.query(`SELECT status FROM autores WHERE ar = "ree" AND channel = "${message.channel.id}"`);
// if(getStatus.length < 1) {
// connection.query(`INSERT INTO autores (ar, status, channel) VALUES ("ree", "1", "${message.channel.id}")`);
// }
return await getStatus[0]['status'] === 1;
}
async exec(message) {
return message.util.send(`${message.content.toUpperCase()}E`);
}
}
module.exports = ReeCommand;
the bot responds to the message whether the trigger is enabled or not, i use a MySQL database where i have a status set to either 0
or 1
per channel to know if it's enabled there or no.
i have tried using aliases
rather than regex
and it worked fine, the issue is only happening with regex :/
the bot also edits the message for some unknown reason. there is a Gif attached.
what could cause this? Am i doing something wrong?
thanks for the help
Metadata
Metadata
Assignees
Labels
No labels