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,14 +1,13 @@
|
|||
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",
|
||||
description: 'View all of your server\'s settings.',
|
||||
usage: 'settings',
|
||||
guildOnly: true,
|
||||
aliases: ["config"]
|
||||
aliases: ['config']
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -20,7 +19,7 @@ class Settings extends Command {
|
|||
.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 }
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 !!"
|
||||
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
|
||||
async run (message, args, data) { // 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')}\``
|
||||
`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]}\``);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Userprefix;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
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]",
|
||||
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]) 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`');
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class Retrieve extends Command {
|
|||
\`\`\``
|
||||
);
|
||||
} else {
|
||||
let res = data[args[0]][args[1]];
|
||||
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 + '```');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue