aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-19 16:48:17 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-19 16:48:17 -0400
commitd29be9345dedefa08e7ae4073cd07c5ac9a661d4 (patch)
tree52b1b3cffbf28b87f1880a74c74bc02696277f22 /src
parentc486d655de34c0827ef2614733af289be5139bc3 (diff)
downloadtanzanite-d29be9345dedefa08e7ae4073cd07c5ac9a661d4.tar.gz
tanzanite-d29be9345dedefa08e7ae4073cd07c5ac9a661d4.tar.bz2
tanzanite-d29be9345dedefa08e7ae4073cd07c5ac9a661d4.zip
fix leveling
Diffstat (limited to 'src')
-rw-r--r--src/commands/dev/reload.ts4
-rw-r--r--src/listeners/message/level.ts9
2 files changed, 8 insertions, 5 deletions
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 928632c..4898ad3 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -35,14 +35,16 @@ export default class ReloadCommand extends BushCommand {
if (!message.author.isOwner())
return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+ let output: { stdout: string; stderr: string; };
try {
const s = new Date();
- await this.client.util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`);
+ output = await this.client.util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`);
this.client.commandHandler.reloadAll();
this.client.listenerHandler.reloadAll();
this.client.inhibitorHandler.reloadAll();
return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
+ if (output) await this.client.logger.error('reloadCommand', output)
return message.util.send(
`An error occurred while reloading:\n${await this.client.util.codeblock(e?.stack || e, 2048 - 34, 'js')}`
);
diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts
index a50f580..1f57930 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -15,7 +15,7 @@ export default class LevelListener extends BushListener {
if (!message.author) return;
if (!message.guild) return;
if (message.util?.parsed?.command) return;
- if (this.levelCooldowns.has(message.guild.id + message.author.id)) return;
+ if (this.levelCooldowns.has(`${message.guild.id}-${message.author.id}`)) return;
if (this.blacklistedChannels.includes(message.channel.id)) return;
if (!['DEFAULT', 'REPLY'].includes(message.type)) return; //checks for join messages, slash commands, booster messages etc
const [user] = await Level.findOrBuild({
@@ -25,7 +25,8 @@ export default class LevelListener extends BushListener {
},
defaults: {
user: message.author.id,
- guild: message.guild.id
+ guild: message.guild.id,
+ xp: 0
}
});
const xpToGive = Level.genRandomizedXp();
@@ -42,7 +43,7 @@ export default class LevelListener extends BushListener {
`LevelMessageListener`,
`Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`
);
- this.levelCooldowns.add(message.guild.id + message.author.id);
- setTimeout(() => this.levelCooldowns.delete(message.author.id), 60_000);
+ this.levelCooldowns.add(`${message.guild.id}-${message.author.id}`);
+ setTimeout(() => this.levelCooldowns.delete(`${message.guild.id}-${message.author.id}`), 60_000);
}
}