this is probably broken

This commit is contained in:
Emily 2020-10-10 19:36:49 +11:00
parent 0f2ad7dd7b
commit 83d2bd1e23

View file

@ -10,16 +10,16 @@ module.exports = class {
async run (message) {
if (message.author.bot) return;
let data = new Object();
const userPrefix = await this.client.db.getUserKey(message.author.id, 'prefix');
const userBlacklisted = await this.client.db.getUserKey(message.author.id, 'blacklisted');
data.user = await this.client.db.getUser(message.author.id);
let memberBlacklisted = false;
const prefixes = [data.user.prefix]
const prefixes = [userPrefix];
if (message.guild) {
data.guild = await this.client.db.getGuild(message.guild.id);
data.member = await this.client.db.getMember(message.guild.id + "-" + message.author.id);
prefixes.push(data.guild.prefix)
memberBlacklisted = await this.client.db.getMemberKey(message.guild.id, message.author.id, 'blacklisted');
prefixes.push(await this.client.db.getGuildKey(message.guild.id, 'prefix'));
};
prefixes.push(`<@${this.client.user.id}> `, `<@!${this.client.user.id}> `)
@ -39,8 +39,8 @@ module.exports = class {
};
// Naughty users can't run commands!
if (message.guild && data.member.blacklisted === true) return;
if (data.user.blacklisted === true) return;
if (message.guild && memberBlacklisted === true) return;
if (userBlacklisted === true) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
@ -132,7 +132,7 @@ module.exports = class {
message.flags.push(args.shift().slice(1));
}
cmd.run(message, args, data);
cmd.run(message, args);
this.client.logger.cmd(`Command ran: ${message.content}`);
// TODO: Command caching if it"s worth it