From 14396092f141bd19c144b52b24f787638d304a62 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 7 Jun 2020 16:49:26 -0400 Subject: [PATCH] Use fetch instead of cache when possible --- commands/games-mp/guesspionage.js | 2 +- commands/games-mp/lie-swatter.js | 2 +- commands/util/cloc.js | 3 ++- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/games-mp/guesspionage.js b/commands/games-mp/guesspionage.js index b6bb8b0b..26504a79 100644 --- a/commands/games-mp/guesspionage.js +++ b/commands/games-mp/guesspionage.js @@ -65,7 +65,7 @@ module.exports = class GuesspionageCommand extends Command { pts.set(player, { points: 0, id: player, - user: this.client.users.cache.get(player) + user: await this.client.users.fetch(player) }); } const used = []; diff --git a/commands/games-mp/lie-swatter.js b/commands/games-mp/lie-swatter.js index e230707c..517ae348 100644 --- a/commands/games-mp/lie-swatter.js +++ b/commands/games-mp/lie-swatter.js @@ -52,7 +52,7 @@ module.exports = class LieSwatterCommand extends Command { pts.set(player, { points: 0, id: player, - user: this.client.users.cache.get(player) + user: await this.client.users.fetch(player) }); } const questions = await this.fetchQuestions(); diff --git a/commands/util/cloc.js b/commands/util/cloc.js index 5b7c5b24..f79514a3 100644 --- a/commands/util/cloc.js +++ b/commands/util/cloc.js @@ -20,7 +20,7 @@ module.exports = class ClocCommand extends Command { } async run(msg) { - const cloc = this.cache || await this.cloc(); + const cloc = await this.cloc(); const embed = new MessageEmbed() .setColor(0x00AE86) .setFooter(`${cloc.header.cloc_url} ${cloc.header.cloc_version}`) @@ -34,6 +34,7 @@ module.exports = class ClocCommand extends Command { } async cloc() { + if (this.cache) return this.cache; const { stdout, stderr } = await exec( path.join(__dirname, '..', '..', 'node_modules', '.bin', 'cloc'), ['--json', '--exclude-dir=node_modules', path.join(__dirname, '..', '..')] diff --git a/package.json b/package.json index 2eecabdb..285523f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.2.2", + "version": "116.2.3", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {