aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/message
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-10-31 22:38:06 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-10-31 22:38:06 -0400
commitc40a94697d64962edda41345e03fa76f51aa431c (patch)
tree1e258d51d6b19b9918f1d478b3f4c51dca3adc93 /src/listeners/message
parent901d9dfc8c5d95b8c76519e700c624294d4df787 (diff)
downloadtanzanite-c40a94697d64962edda41345e03fa76f51aa431c.tar.gz
tanzanite-c40a94697d64962edda41345e03fa76f51aa431c.tar.bz2
tanzanite-c40a94697d64962edda41345e03fa76f51aa431c.zip
upgrade typescript, improve workflow, bunch of bug fixes and some other things
Diffstat (limited to 'src/listeners/message')
-rw-r--r--src/listeners/message/autoPublisher.ts2
-rw-r--r--src/listeners/message/autoThread.ts7
-rw-r--r--src/listeners/message/automodCreate.ts2
-rw-r--r--src/listeners/message/automodUpdate.ts2
-rw-r--r--src/listeners/message/blacklistedFile.ts4
-rw-r--r--src/listeners/message/boosterMessage.ts2
-rw-r--r--src/listeners/message/directMessage.ts2
-rw-r--r--src/listeners/message/level.ts16
-rw-r--r--src/listeners/message/verbose.ts2
9 files changed, 20 insertions, 19 deletions
diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts
index a0ae39e..2714296 100644
--- a/src/listeners/message/autoPublisher.ts
+++ b/src/listeners/message/autoPublisher.ts
@@ -1,4 +1,4 @@
-import { BushClientEvents, BushListener } from '@lib';
+import { BushListener, type BushClientEvents } from '@lib';
export default class autoPublisherListener extends BushListener {
public constructor() {
diff --git a/src/listeners/message/autoThread.ts b/src/listeners/message/autoThread.ts
index 319b214..2f0dee8 100644
--- a/src/listeners/message/autoThread.ts
+++ b/src/listeners/message/autoThread.ts
@@ -1,5 +1,5 @@
-import { BushClientEvents, BushListener, BushTextChannel } from '@lib';
-import { GuildTextBasedChannels } from 'discord-akairo';
+import { BushListener, type BushClientEvents, type BushTextChannel } from '@lib';
+import { type GuildTextBasedChannels } from 'discord-akairo';
import { MessageEmbed } from 'discord.js';
export default class autoThreadListener extends BushListener {
@@ -41,7 +41,8 @@ export default class autoThreadListener extends BushListener {
name: `Support - ${message.author.username}#${message.author.discriminator}`,
autoArchiveDuration: 60,
reason: 'Support Thread'
- });
+ }).catch(() => null);
+ if (!thread) return;
const embed = new MessageEmbed()
.setTitle('NotEnoughUpdates Support')
.setDescription(
diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts
index 0bf4c29..5182557 100644
--- a/src/listeners/message/automodCreate.ts
+++ b/src/listeners/message/automodCreate.ts
@@ -1,4 +1,4 @@
-import { AutoMod, BushClientEvents, BushListener } from '@lib';
+import { AutoMod, BushListener, type BushClientEvents } from '@lib';
export default class AutomodMessageCreateListener extends BushListener {
public constructor() {
diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts
index ff89a09..fc1f355 100644
--- a/src/listeners/message/automodUpdate.ts
+++ b/src/listeners/message/automodUpdate.ts
@@ -1,4 +1,4 @@
-import { AutoMod, BushClientEvents, BushListener, BushMessage } from '@lib';
+import { AutoMod, BushListener, type BushClientEvents, type BushMessage } from '@lib';
export default class AutomodMessageUpdateListener extends BushListener {
public constructor() {
diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts
index 11af787..bc8b335 100644
--- a/src/listeners/message/blacklistedFile.ts
+++ b/src/listeners/message/blacklistedFile.ts
@@ -1,5 +1,5 @@
-import { BushClientEvents, BushListener } from '@lib';
-import crypto from 'crypto';
+import { BushListener, type BushClientEvents } from '@lib';
+import * as crypto from 'crypto';
import got from 'got';
export default class BlacklistedFileListener extends BushListener {
diff --git a/src/listeners/message/boosterMessage.ts b/src/listeners/message/boosterMessage.ts
index a161784..6fcd06e 100644
--- a/src/listeners/message/boosterMessage.ts
+++ b/src/listeners/message/boosterMessage.ts
@@ -1,4 +1,4 @@
-import { BushClientEvents, BushListener } from '@lib';
+import { BushListener, type BushClientEvents } from '@lib';
export default class BoosterMessageListener extends BushListener {
public constructor() {
diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts
index 41e4792..2162c3a 100644
--- a/src/listeners/message/directMessage.ts
+++ b/src/listeners/message/directMessage.ts
@@ -1,4 +1,4 @@
-import { BushClientEvents, BushListener } from '@lib';
+import { BushListener, type BushClientEvents } from '@lib';
import { MessageEmbed } from 'discord.js';
export default class DirectMessageListener extends BushListener {
diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts
index 06e0485..3702a05 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -1,5 +1,5 @@
-import { BushCommandHandlerEvents, BushGuild, BushListener, BushMessage, Level } from '@lib';
-import { MessageType } from 'discord.js';
+import { BushListener, Level, type BushCommandHandlerEvents, type BushGuild, type BushMessage } from '@lib';
+import { type MessageType } from 'discord.js';
export default class LevelListener extends BushListener {
#levelCooldowns: Set<string> = new Set();
@@ -11,8 +11,8 @@ export default class LevelListener extends BushListener {
});
}
public override async exec(...[message]: BushCommandHandlerEvents['messageInvalid']) {
- if (message.author.bot || !message.author || !message.guild) return;
- if (this.#levelCooldowns.has(`${message.guild.id}-${message.author.id}`)) return;
+ if (message.author.bot || !message.author || !message.guild || !message.guildId) return;
+ if (this.#levelCooldowns.has(`${message.guildId}-${message.author.id}`)) return;
if ((await message.guild.getSetting('noXpChannels')).includes(message.channel.id)) return;
const allowedMessageTypes: MessageType[] = ['DEFAULT', 'REPLY']; // this is so ts will yell at me when discord.js makes some unnecessary breaking change
@@ -20,11 +20,11 @@ export default class LevelListener extends BushListener {
const [user] = await Level.findOrBuild({
where: {
user: message.author.id,
- guild: message.guild.id
+ guild: message.guildId
},
defaults: {
user: message.author.id,
- guild: message.guild.id,
+ guild: message.guildId,
xp: 0
}
});
@@ -47,7 +47,7 @@ export default class LevelListener extends BushListener {
);
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}`);
- setTimeout(() => this.#levelCooldowns.delete(`${message.guild!.id}-${message.author.id}`), 60_000);
+ this.#levelCooldowns.add(`${message.guildId}-${message.author.id}`);
+ setTimeout(() => this.#levelCooldowns.delete(`${message.guildId}-${message.author.id}`), 60_000);
}
}
diff --git a/src/listeners/message/verbose.ts b/src/listeners/message/verbose.ts
index 8214471..fbbf055 100644
--- a/src/listeners/message/verbose.ts
+++ b/src/listeners/message/verbose.ts
@@ -1,4 +1,4 @@
-import { BushClientEvents, BushListener } from '@lib';
+import { BushListener, type BushClientEvents } from '@lib';
export default class MessageVerboseListener extends BushListener {
public constructor() {