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) { async run (message) {
if (message.author.bot) return; if (message.author.bot) return;
let data = {}; const data = {};
data.user = await this.client.db.getUser(message.author.id); data.user = await this.client.db.getUser(message.author.id);
const prefixes = [data.user.prefix]; const prefixes = [data.user.prefix];

View file

@ -11,24 +11,24 @@ class Database {
} }
async getGuild (id) { 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]; return res.rows[0];
} }
async getMember (guild_id, user_id) { async getMember (guild_id, user_id) {
const key = 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]; return res.rows[0];
} }
async getUser (id) { 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]; return res.rows[0];
} }
async updateGuild (id, column, newValue) { async updateGuild (id, column, newValue) {
const sql = format('UPDATE guilds SET %I = $1 WHERE guild_id = $2;', column); 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; return;
} }

View file

@ -18,7 +18,7 @@ class Functions {
} }
async getLastMessage (channel) { async getLastMessage (channel) {
let messages = await channel.messages.fetch({ limit: 2 }); const messages = await channel.messages.fetch({ limit: 2 });
return messages.last().content; return messages.last().content;
} }
@ -42,7 +42,7 @@ class Functions {
searchForMembers (guild, query) { searchForMembers (guild, query) {
query = query.toLowerCase(); query = query.toLowerCase();
let matches = []; const matches = [];
let match; let match;
try { try {