diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-31 22:38:06 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-31 22:38:06 -0400 |
commit | c40a94697d64962edda41345e03fa76f51aa431c (patch) | |
tree | 1e258d51d6b19b9918f1d478b3f4c51dca3adc93 /src/listeners | |
parent | 901d9dfc8c5d95b8c76519e700c624294d4df787 (diff) | |
download | tanzanite-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')
38 files changed, 57 insertions, 56 deletions
diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts index 40c7628..6afc1a1 100644 --- a/src/listeners/client/interactionCreate.ts +++ b/src/listeners/client/interactionCreate.ts @@ -1,4 +1,4 @@ -import { AutoMod, BushButtonInteraction, BushClientEvents, BushListener } from '@lib'; +import { AutoMod, BushListener, type BushButtonInteraction, type BushClientEvents } from '@lib'; export default class InteractionCreateListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 074b6d6..4f9f492 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -1,5 +1,5 @@ -import { BushCommand, BushCommandHandlerEvents, BushListener, BushMessage, BushSlashMessage } from '@lib'; -import { InteractionReplyOptions, Message, MessagePayload, ReplyMessageOptions } from 'discord.js'; +import { BushListener, BushSlashMessage, type BushCommand, type BushCommandHandlerEvents, type BushMessage } from '@lib'; +import { type InteractionReplyOptions, type Message, type MessagePayload, type ReplyMessageOptions } from 'discord.js'; export default class CommandBlockedListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/commandCooldown.ts b/src/listeners/commands/commandCooldown.ts index 118b676..b357ed8 100644 --- a/src/listeners/commands/commandCooldown.ts +++ b/src/listeners/commands/commandCooldown.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents, type BushMessage } from '@lib'; export default class CommandCooldownListener extends BushListener { public constructor() { @@ -21,6 +21,6 @@ export default class CommandCooldownListener extends BushListener { content: `⏳ This command is on cooldown for ${Math.round(remaining / 1000)} seconds.`, ephemeral: true }) - : await message.react('⏳').catch(() => null); + : await (message as BushMessage).react('⏳').catch(() => null); } } diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index f29c7e0..a7303e8 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -1,7 +1,7 @@ -import { BushCommandHandlerEvents } from '@lib'; +import { type BushCommandHandlerEvents } from '@lib'; import { Severity } from '@sentry/types'; -import { AkairoMessage, Command, GuildTextBasedChannels } from 'discord-akairo'; -import { DMChannel, Formatters, Message, MessageEmbed } from 'discord.js'; +import { Command, type AkairoMessage, type GuildTextBasedChannels } from 'discord-akairo'; +import { Formatters, MessageEmbed, type DMChannel, type Message } from 'discord.js'; import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; export default class CommandErrorListener extends BushListener { diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index c8a3a6e..010682c 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; export default class CommandMissingPermissionsListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index 5d77d66..eff8c94 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -1,7 +1,7 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; import { Severity } from '@sentry/types'; -import { GuildTextBasedChannels } from 'discord-akairo'; -import { DMChannel } from 'discord.js'; +import { type GuildTextBasedChannels } from 'discord-akairo'; +import { type DMChannel } from 'discord.js'; export default class CommandStartedListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/messageBlocked.ts b/src/listeners/commands/messageBlocked.ts index 0b1001c..7299eca 100644 --- a/src/listeners/commands/messageBlocked.ts +++ b/src/listeners/commands/messageBlocked.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; export default class MessageBlockedListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts index 6c94187..b5c57bf 100644 --- a/src/listeners/commands/slashBlocked.ts +++ b/src/listeners/commands/slashBlocked.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; import CommandBlockedListener from './commandBlocked'; export default class SlashBlockedListener extends BushListener { diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index 9b194e5..435e449 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; import CommandErrorListener from './commandError'; export default class SlashCommandErrorListener extends BushListener { diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts index 33a9363..969c0e9 100644 --- a/src/listeners/commands/slashMissingPermissions.ts +++ b/src/listeners/commands/slashMissingPermissions.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; import CommandMissingPermissionsListener from './commandMissingPermissions'; export default class SlashMissingPermissionsListener extends BushListener { diff --git a/src/listeners/commands/slashNotFound.ts b/src/listeners/commands/slashNotFound.ts index c5d92bd..26635e8 100644 --- a/src/listeners/commands/slashNotFound.ts +++ b/src/listeners/commands/slashNotFound.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; export default class SlashNotFoundListener extends BushListener { public constructor() { diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index e9e4028..46b6610 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -1,4 +1,4 @@ -import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { BushListener, type BushCommandHandlerEvents } from '@lib'; export default class SlashStartedListener extends BushListener { public constructor() { diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts index ee5ebcf..8352099 100644 --- a/src/listeners/custom/bushBan.ts +++ b/src/listeners/custom/bushBan.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushBanListener extends BushListener { diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts index 74d90e4..ceb4d54 100644 --- a/src/listeners/custom/bushKick.ts +++ b/src/listeners/custom/bushKick.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushKickListener extends BushListener { diff --git a/src/listeners/custom/bushLevelUpdate.ts b/src/listeners/custom/bushLevelUpdate.ts index a4b999b..a5aca7a 100644 --- a/src/listeners/custom/bushLevelUpdate.ts +++ b/src/listeners/custom/bushLevelUpdate.ts @@ -1,5 +1,5 @@ -import { BushClientEvents, BushListener } from '@lib'; -import { Formatters, TextChannel } from 'discord.js'; +import { BushListener, type BushClientEvents } from '@lib'; +import { Formatters, type TextChannel } from 'discord.js'; export default class BushLevelUpdateListener extends BushListener { public constructor() { diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts index c5b1d74..67200fe 100644 --- a/src/listeners/custom/bushMute.ts +++ b/src/listeners/custom/bushMute.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushMuteListener extends BushListener { diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts index f34f1d8..b434cd3 100644 --- a/src/listeners/custom/bushPunishRole.ts +++ b/src/listeners/custom/bushPunishRole.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushPunishRoleListener extends BushListener { diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts index fa09f44..c147101 100644 --- a/src/listeners/custom/bushPunishRoleRemove.ts +++ b/src/listeners/custom/bushPunishRoleRemove.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushPunishRoleRemoveListener extends BushListener { diff --git a/src/listeners/custom/bushPurge.ts b/src/listeners/custom/bushPurge.ts index ac81916..aa43612 100644 --- a/src/listeners/custom/bushPurge.ts +++ b/src/listeners/custom/bushPurge.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { MessageEmbed } from 'discord.js'; export default class BushPurgeListener extends BushListener { diff --git a/src/listeners/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts index b2007fd..7c8f3cb 100644 --- a/src/listeners/custom/bushUnban.ts +++ b/src/listeners/custom/bushUnban.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushUnbanListener extends BushListener { diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts index c34cc14..7ef0745 100644 --- a/src/listeners/custom/bushUnmute.ts +++ b/src/listeners/custom/bushUnmute.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushUnmuteListener extends BushListener { diff --git a/src/listeners/custom/bushUpdateModlog.ts b/src/listeners/custom/bushUpdateModlog.ts index 62979ae..105c6ad 100644 --- a/src/listeners/custom/bushUpdateModlog.ts +++ b/src/listeners/custom/bushUpdateModlog.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { MessageEmbed } from 'discord.js'; export default class BushUpdateModlogListener extends BushListener { diff --git a/src/listeners/custom/bushUpdateSettings.ts b/src/listeners/custom/bushUpdateSettings.ts index 39e76c7..2a9421f 100644 --- a/src/listeners/custom/bushUpdateSettings.ts +++ b/src/listeners/custom/bushUpdateSettings.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { MessageEmbed } from 'discord.js'; export default class BushUpdateSettingsListener extends BushListener { diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts index b787b5c..027cb65 100644 --- a/src/listeners/custom/bushWarn.ts +++ b/src/listeners/custom/bushWarn.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; export default class BushWarnListener extends BushListener { diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts index 622958f..419d773 100644 --- a/src/listeners/guild/guildCreate.ts +++ b/src/listeners/guild/guildCreate.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener, Guild } from '@lib'; +import { BushListener, Guild, type BushClientEvents } from '@lib'; export default class GuildCreateListener extends BushListener { public constructor() { diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts index 4db092b..674feb1 100644 --- a/src/listeners/guild/guildDelete.ts +++ b/src/listeners/guild/guildDelete.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushListener } from '@lib'; +import { BushListener, type BushClientEvents } from '@lib'; export default class GuildDeleteListener extends BushListener { public constructor() { diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index 295b889..264ea12 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -1,5 +1,5 @@ -import { BushClientEvents, BushGuildMember, BushListener, BushTextChannel, StickyRole } from '@lib'; -import { MessageEmbed, Snowflake, Util } from 'discord.js'; +import { BushListener, StickyRole, type BushClientEvents, type BushGuildMember, type BushTextChannel } from '@lib'; +import { MessageEmbed, Util, type Snowflake } from 'discord.js'; export default class GuildMemberAddListener extends BushListener { public constructor() { diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts index 57ed5ce..d9c9b6f 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -1,4 +1,4 @@ -import { BushClientEvents, BushGuildMember, BushListener, BushTextChannel, PartialBushGuildMember, StickyRole } from '@lib'; +import { BushGuildMember, BushListener, BushTextChannel, StickyRole, type BushClientEvents, type PartialBushGuildMember } from '@lib'; import { MessageEmbed, Util } from 'discord.js'; export default class GuildMemberRemoveListener extends BushListener { diff --git a/src/listeners/guild/syncUnban.ts b/src/listeners/guild/syncUnban.ts index db654b8..2062679 100644 --- a/src/listeners/guild/syncUnban.ts +++ b/src/listeners/guild/syncUnban.ts @@ -1,4 +1,4 @@ -import { ActivePunishment, ActivePunishmentType, BushClientEvents, BushListener } from '@lib'; +import { ActivePunishment, ActivePunishmentType, BushListener, type BushClientEvents } from '@lib'; export default class SyncUnbanListener extends BushListener { public constructor() { 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() { |