formatting fixes + update commands for postgres
This commit is contained in:
parent
432caf5276
commit
06d5cc55cb
3 changed files with 65 additions and 63 deletions
|
@ -1,27 +1,26 @@
|
|||
const { DiscordAPIError } = require("discord.js");
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const Command = require("../../base/Command.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"]
|
||||
});
|
||||
}
|
||||
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);
|
||||
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 }
|
||||
)
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
const Command = require("../../base/Command.js");
|
||||
const Command = require('../../base/Command.js');
|
||||
|
||||
class Userprefix extends Command {
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
description: "Change the prefix you use for Woomy. This will affect servers and commands in DM's.",
|
||||
usage: "`userprefix` <new prefix>",
|
||||
examples: "`userprefix !!` - Sets your personal prefix to !!"
|
||||
});
|
||||
}
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
description: 'Change the prefix you use for Woomy. This will affect servers and commands in DM\'s.',
|
||||
usage: '`userprefix` <new prefix>',
|
||||
examples: '`userprefix !!` - Sets your personal prefix to !!'
|
||||
});
|
||||
}
|
||||
|
||||
async run (message, args) { // eslint-disable-line no-unused-vars
|
||||
if (!args[0]) {
|
||||
return message.channel.send(
|
||||
`Your prefix for Woomy is currently: \`${await this.client.db.getUserKey(message.author.id, 'prefix')}\``
|
||||
);
|
||||
};
|
||||
async run (message, args, data) { // eslint-disable-line no-unused-vars
|
||||
if (!args[0]) {
|
||||
return message.channel.send(
|
||||
`Your prefix for Woomy is currently: \`${data.user.prefix}\``
|
||||
);
|
||||
}
|
||||
|
||||
await this.client.db.setUserKey(message.author.id, 'prefix', args[0]);
|
||||
await this.client.db.updateUser(message.author.id, 'prefix', args[0]);
|
||||
|
||||
// Update cache
|
||||
this.client.prefixCache.set(message.author.id, args[0]);
|
||||
|
||||
message.channel.send(`Your personal prefix has been set to: \`${args[0]}\``);
|
||||
};
|
||||
};
|
||||
message.channel.send(`Your personal prefix has been set to: \`${args[0]}\``);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Userprefix;
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
const Command = require("../../base/Command.js");
|
||||
const Command = require('../../base/Command.js');
|
||||
|
||||
class Retrieve extends Command {
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
description: "Retrieves a key's value from the Redis DB.",
|
||||
usage: "retrieve [key]",
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
description: 'Retrieves a key\'s value from the Postgres DB.',
|
||||
usage: 'retrieve [setting]',
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
async run (message, args, data) { // eslint-disable-line no-unused-vars
|
||||
if (!args[0]) return message.channel.send("You didn't specify what database to access!");
|
||||
if (args[0].toLowerCase() !== 'guild' && args[0].toLowerCase() !== 'member' && args[0].toLowerCase() !== 'user') {
|
||||
return message.channel.send('Invalid database. Valid databases: `guild`, `member`, `user`');
|
||||
}
|
||||
async run (message, args, data) { // eslint-disable-line no-unused-vars
|
||||
if (!args[0]) return message.channel.send('You didn\'t specify what database to access!');
|
||||
if (args[0].toLowerCase() !== 'guild' && args[0].toLowerCase() !== 'member' && args[0].toLowerCase() !== 'user') {
|
||||
return message.channel.send('Invalid database. Valid databases: `guild`, `member`, `user`');
|
||||
}
|
||||
|
||||
if (!args[1]) {
|
||||
message.channel.send(
|
||||
`\`\`\`js
|
||||
${JSON.stringify(data[args[0]])}
|
||||
\`\`\``
|
||||
);
|
||||
} else {
|
||||
let res = data[args[0]][args[1]];
|
||||
if (!res) return message.channel.send('Invalid key. Check for typing errors and try again.');
|
||||
message.channel.send('```' + res + '```');
|
||||
}
|
||||
}
|
||||
if (!args[1]) {
|
||||
message.channel.send(
|
||||
`\`\`\`js
|
||||
${JSON.stringify(data[args[0]])}
|
||||
\`\`\``
|
||||
);
|
||||
} else {
|
||||
const res = data[args[0]][args[1]];
|
||||
if (!res) return message.channel.send('Invalid key. Check for typing errors and try again.');
|
||||
message.channel.send('```' + res + '```');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Retrieve;
|
||||
|
|
Loading…
Reference in a new issue