ERRORS BEGONE

This commit is contained in:
Emily 2020-10-17 16:17:02 +11:00
parent fc9a0dc33c
commit 7a6a74d161
4 changed files with 12 additions and 12 deletions

View file

@ -10,7 +10,7 @@ module.exports = class {
async run (message) {
if (message.author.bot) return;
let data = {};
const data = {};
data.user = await this.client.db.getUser(message.author.id);
const prefixes = [data.user.prefix];

View file

@ -41,7 +41,7 @@ class WoomyClient extends Client {
}
}
async function init() {
async function init () {
const client = new WoomyClient();
client.logger.info(`Initializing Woomy v${client.version}`);

View file

@ -5,30 +5,30 @@ const format = require('pg-format');
const { pgCredentials } = require('../../config.json');
class Database {
constructor(client) {
constructor (client) {
this.client = client;
this.pool = new Pool(pgCredentials);
}
async getGuild (id) {
let res = await this.pool.query('SELECT * FROM guilds WHERE guild_id = $1;', [id]);
const res = await this.pool.query('SELECT * FROM guilds WHERE guild_id = $1;', [id]);
return res.rows[0];
}
async getMember (guild_id, user_id) {
const key = guild_id + ':' + user_id;
let res = await this.pool.query('SELECT * FROM members WHERE member_id = $1;', [key]);
const res = await this.pool.query('SELECT * FROM members WHERE member_id = $1;', [key]);
return res.rows[0];
}
async getUser (id) {
let res = await this.pool.query('SELECT * FROM guilds WHERE user_id = $1;', [id]);
const res = await this.pool.query('SELECT * FROM guilds WHERE user_id = $1;', [id]);
return res.rows[0];
}
async updateGuild (id, column, newValue) {
const sql = format('UPDATE guilds SET %I = $1 WHERE guild_id = $2;', column);
let res = await this.pool.query(sql, [newValue, id]);
const res = await this.pool.query(sql, [newValue, id]);
return;
}

View file

@ -18,11 +18,11 @@ class Functions {
}
async getLastMessage (channel) {
let messages = await channel.messages.fetch({ limit: 2 });
const messages = await channel.messages.fetch({ limit: 2 });
return messages.last().content;
}
async awaitReply(message, question, limit = 60000) {
async awaitReply (message, question, limit = 60000) {
const filter = (m) => m.author.id === message.author.id;
await message.channel.send(question);
@ -42,7 +42,7 @@ class Functions {
searchForMembers (guild, query) {
query = query.toLowerCase();
let matches = [];
const matches = [];
let match;
try {
@ -67,10 +67,10 @@ class Functions {
findRole (input, message) {
let role;
role = message.guild.roles.cache.find(r => r.name.toLowerCase() === input.toLowerCase());
if(!role) {
if (!role) {
role = message.guild.roles.cache.get(input.toLowerCase());
}
if(!role) return;
if (!role) return;
return role;
}