redis limitations

This commit is contained in:
Emily 2020-10-11 15:03:54 +11:00
parent 8d5c0e4c00
commit 6dd7d93efd
2 changed files with 35 additions and 9 deletions

View file

@ -0,0 +1,27 @@
const { DiscordAPIError } = require("discord.js");
const { MessageEmbed } = require("discord.js");
const Command = require("../../base/Command.js");
class Settings extends Command {
constructor (client) {
super(client, {
description: "View all of your server's settings.",
usage: "settings",
guildOnly: true,
aliases: ["config"]
});
}
async run (message, args) { // eslint-disable-line no-unused-vars
const settings = await this.client.db.getGuild(message.guild.id);
const embed = new MessageEmbed()
.setAuthor('Settings Panel', message.guild.iconURL({dynamic: true}))
.setDescription('All the settings for this server are listed below. To set a setting, use `set [setting] [what you want to set it to]')
.addFields(
{ name: '**Prefix**', value: settings.prefix }
)
}
}
module.exports = Settings;

View file

@ -13,14 +13,9 @@ module.exports = class {
const userPrefix = await this.client.db.getUserKey(message.author.id, 'prefix'); const userPrefix = await this.client.db.getUserKey(message.author.id, 'prefix');
const userBlacklisted = await this.client.db.getUserKey(message.author.id, 'blacklisted'); const userBlacklisted = await this.client.db.getUserKey(message.author.id, 'blacklisted');
let memberBlacklisted = false;
const prefixes = [userPrefix]; const prefixes = [userPrefix];
if (message.guild) { if (message.guild) prefixes.push(await this.client.db.getGuildKey(message.guild.id, '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}> `) prefixes.push(`<@${this.client.user.id}> `, `<@!${this.client.user.id}> `)
@ -37,10 +32,14 @@ module.exports = class {
} else { } else {
message.prefix = prefix; message.prefix = prefix;
}; };
// Naughty users can't run commands! // Naughty users can't run commands!
if (message.guild && memberBlacklisted === true) return; if (message.guild) {
if (userBlacklisted === true) return; const check = await this.client.db.getMemberKey(message.guild.id, message.author.id, 'blacklisted')
if (check === true) { return };
};
if (userBlacklisted) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g); const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();