aboutsummaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/message/autoThread.ts2
-rw-r--r--src/listeners/message/level.ts3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/listeners/message/autoThread.ts b/src/listeners/message/autoThread.ts
index ec8bfcb..04f6bcf 100644
--- a/src/listeners/message/autoThread.ts
+++ b/src/listeners/message/autoThread.ts
@@ -6,7 +6,7 @@ import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEven
export default class autoThreadListener extends BushListener {
public constructor() {
super('autoThread', {
- emitter: 'client',
+ emitter: 'commandHandler',
event: 'messageInvalid',
category: 'message'
});
diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts
index 7004d52..aff8190 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -28,12 +28,15 @@ export default class LevelListener extends BushListener {
xp: 0
}
});
+ const previousLevel = Level.convertXpToLevel(user.xp);
const xpToGive = Level.genRandomizedXp();
user.xp = user.xp + xpToGive;
const success = await user.save().catch((e) => {
void util.handleError('level', e);
return false;
});
+ const newLevel = Level.convertXpToLevel(user.xp);
+ if (previousLevel < newLevel) client.emit('bushLevelUp');
if (success)
void client.logger.verbose(`level`, `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`);
this.#levelCooldowns.add(`${message.guild.id}-${message.author.id}`);