From c40a94697d64962edda41345e03fa76f51aa431c Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 31 Oct 2021 22:38:06 -0400 Subject: upgrade typescript, improve workflow, bunch of bug fixes and some other things --- src/lib/badwords.ts | 2 +- src/lib/common/AutoMod.ts | 8 +- src/lib/common/ButtonPaginator.ts | 31 +++--- src/lib/common/DeleteButton.ts | 5 +- src/lib/common/Format.ts | 2 +- src/lib/common/Moderation.ts | 12 +- src/lib/common/typings/BushInspectOptions.d.ts | 2 +- src/lib/common/util/Arg.ts | 8 +- .../discord-akairo/BushArgumentTypeCaster.ts | 2 +- src/lib/extensions/discord-akairo/BushClient.ts | 33 +++--- .../extensions/discord-akairo/BushClientUtil.ts | 34 +++--- src/lib/extensions/discord-akairo/BushCommand.ts | 9 +- .../discord-akairo/BushCommandHandler.ts | 9 +- .../extensions/discord-akairo/BushCommandUtil.ts | 10 +- src/lib/extensions/discord-akairo/BushInhibitor.ts | 5 +- .../discord-akairo/BushInhibitorHandler.ts | 2 +- src/lib/extensions/discord-akairo/BushListener.ts | 5 +- .../discord-akairo/BushListenerHandler.ts | 2 +- .../extensions/discord-akairo/BushSlashMessage.ts | 8 +- src/lib/extensions/discord-akairo/BushTask.ts | 4 +- .../extensions/discord-akairo/BushTaskHandler.ts | 4 +- src/lib/extensions/discord.js/BushActivity.ts | 5 +- .../discord.js/BushApplicationCommand.ts | 7 +- .../discord.js/BushApplicationCommandManager.d.ts | 16 ++- .../BushApplicationCommandPermissionsManager.d.ts | 23 ++-- .../discord.js/BushBaseGuildEmojiManager.d.ts | 8 +- .../discord.js/BushBaseGuildTextChannel.ts | 22 ++-- .../extensions/discord.js/BushButtonInteraction.ts | 13 +-- .../extensions/discord.js/BushCategoryChannel.ts | 9 +- src/lib/extensions/discord.js/BushChannel.d.ts | 12 +- .../extensions/discord.js/BushChannelManager.d.ts | 8 +- .../extensions/discord.js/BushClientEvents.d.ts | 70 ++++++------ src/lib/extensions/discord.js/BushClientUser.d.ts | 14 +-- .../discord.js/BushCommandInteraction.ts | 26 +++-- src/lib/extensions/discord.js/BushDMChannel.ts | 6 +- src/lib/extensions/discord.js/BushEmoji.ts | 4 +- src/lib/extensions/discord.js/BushGuild.ts | 22 ++-- .../BushGuildApplicationCommandManager.d.ts | 16 ++- src/lib/extensions/discord.js/BushGuildBan.d.ts | 6 +- src/lib/extensions/discord.js/BushGuildChannel.ts | 5 +- src/lib/extensions/discord.js/BushGuildEmoji.ts | 7 +- .../discord.js/BushGuildEmojiRoleManager.d.ts | 7 +- .../extensions/discord.js/BushGuildManager.d.ts | 16 ++- src/lib/extensions/discord.js/BushGuildMember.ts | 11 +- .../discord.js/BushGuildMemberManager.d.ts | 34 +++--- src/lib/extensions/discord.js/BushMessage.ts | 21 ++-- .../extensions/discord.js/BushMessageManager.d.ts | 44 ++++---- .../extensions/discord.js/BushMessageReaction.ts | 9 +- src/lib/extensions/discord.js/BushNewsChannel.ts | 9 +- src/lib/extensions/discord.js/BushPresence.ts | 7 +- src/lib/extensions/discord.js/BushReactionEmoji.ts | 6 +- src/lib/extensions/discord.js/BushRole.ts | 9 +- .../discord.js/BushSelectMenuInteraction.ts | 13 +-- src/lib/extensions/discord.js/BushStageChannel.ts | 11 +- src/lib/extensions/discord.js/BushStageInstance.ts | 7 +- src/lib/extensions/discord.js/BushStoreChannel.ts | 10 +- src/lib/extensions/discord.js/BushTextChannel.ts | 10 +- src/lib/extensions/discord.js/BushThreadChannel.ts | 20 ++-- .../extensions/discord.js/BushThreadManager.d.ts | 44 ++++---- src/lib/extensions/discord.js/BushThreadMember.ts | 6 +- .../discord.js/BushThreadMemberManager.d.ts | 20 ++-- src/lib/extensions/discord.js/BushUser.ts | 7 +- src/lib/extensions/discord.js/BushUserManager.d.ts | 8 +- src/lib/extensions/discord.js/BushVoiceChannel.ts | 8 +- src/lib/extensions/discord.js/BushVoiceState.ts | 8 +- src/lib/index.ts | 2 + src/lib/models/ActivePunishment.ts | 57 ++++++---- src/lib/models/BaseModel.ts | 18 +-- src/lib/models/Global.ts | 45 +++++--- src/lib/models/Guild.ts | 121 +++++++++++++-------- src/lib/models/Level.ts | 47 ++++---- src/lib/models/ModLog.ts | 73 ++++++++----- src/lib/models/Stat.ts | 19 ++-- src/lib/models/StickyRole.ts | 33 +++--- src/lib/models/__helpers.ts | 2 +- src/lib/utils/AllowedMentions.ts | 2 +- src/lib/utils/BushCache.ts | 2 +- src/lib/utils/BushConstants.ts | 2 +- src/lib/utils/BushLogger.ts | 4 +- src/lib/utils/Config.ts | 2 +- 80 files changed, 640 insertions(+), 630 deletions(-) (limited to 'src/lib') diff --git a/src/lib/badwords.ts b/src/lib/badwords.ts index 5caddd5..18c7755 100644 --- a/src/lib/badwords.ts +++ b/src/lib/badwords.ts @@ -1,4 +1,4 @@ -import { BadWords, Severity } from "./common/AutoMod"; +import { Severity, type BadWords } from "./common/AutoMod"; export default { /* -------------------------------------------------------------------------- */ diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 38c488b..c749a33 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -1,10 +1,8 @@ -import { GuildMember, MessageActionRow, MessageButton, MessageEmbed, TextChannel } from 'discord.js'; +import { Moderation, type BushButtonInteraction, type BushMessage } from '@lib'; +import { GuildMember, MessageActionRow, MessageButton, MessageEmbed, type TextChannel } from 'discord.js'; import badLinksArray from '../badlinks'; import badLinksSecretArray from '../badlinks-secret'; // I cannot make this public so just make a new file that export defaults an empty array import badWords from '../badwords'; -import { BushButtonInteraction } from '../extensions/discord.js/BushButtonInteraction'; -import { BushMessage } from '../extensions/discord.js/BushMessage'; -import { Moderation } from './Moderation'; export class AutoMod { private message: BushMessage; @@ -190,7 +188,7 @@ export class AutoMod { const [action, userId, reason] = interaction.customId.replace('automod;', '').split(';'); switch (action) { case 'ban': { - const victim = await interaction.guild!.members.fetch(userId); + const victim = await interaction.guild!.members.fetch(userId).catch(() => null); const moderator = interaction.member instanceof GuildMember ? interaction.member diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index da595d5..58134b5 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -1,13 +1,12 @@ +import { DeleteButton, type BushMessage, type BushSlashMessage } from '@lib'; import { Constants, MessageActionRow, MessageButton, - MessageComponentInteraction, MessageEmbed, - MessageEmbedOptions + type MessageComponentInteraction, + type MessageEmbedOptions } from 'discord.js'; -import { BushMessage, BushSlashMessage } from '..'; -import { DeleteButton } from './DeleteButton'; export class ButtonPaginator { protected message: BushMessage | BushSlashMessage; @@ -86,7 +85,7 @@ export class ButtonPaginator { protected async collect(interaction: MessageComponentInteraction) { if (interaction.user.id !== this.message.author.id && !client.config.owners.includes(interaction.user.id)) - return await interaction?.deferUpdate().catch(() => undefined); + return await interaction?.deferUpdate().catch(() => null); switch (interaction.customId) { case 'paginate_beginning': @@ -97,8 +96,8 @@ export class ButtonPaginator { return await this.edit(interaction); case 'paginate_stop': if (this.deleteOnExit) { - await interaction.deferUpdate().catch(() => undefined); - return await this.sentMessage!.delete().catch(() => undefined); + await interaction.deferUpdate().catch(() => null); + return await this.sentMessage!.delete().catch(() => null); } else { return await interaction ?.update({ @@ -106,7 +105,7 @@ export class ButtonPaginator { embeds: [], components: [] }) - .catch(() => undefined); + .catch(() => null); } case 'paginate_next': this.curPage++; @@ -125,19 +124,15 @@ export class ButtonPaginator { embeds: [this.embeds[this.curPage]], components: [this.getPaginationRow(true)] }) - .catch(() => undefined); + .catch(() => null); } protected async edit(interaction: MessageComponentInteraction) { - try { - return interaction?.update({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow()] - }); - } catch (e) { - return undefined; - } + return interaction?.update({ + content: this.text, + embeds: [this.embeds[this.curPage]], + components: [this.getPaginationRow()] + }).catch(() => null); } protected getPaginationRow(disableAll = false): MessageActionRow { diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index 7d2e41b..95bae24 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -1,6 +1,5 @@ -import { Constants, MessageActionRow, MessageButton, MessageComponentInteraction, MessageOptions } from 'discord.js'; -import { BushMessage, BushSlashMessage } from '..'; -import { PaginateEmojis } from './ButtonPaginator'; +import { PaginateEmojis, type BushMessage, type BushSlashMessage } from '@lib'; +import { Constants, MessageActionRow, MessageButton, type MessageComponentInteraction, type MessageOptions } from 'discord.js'; export class DeleteButton { protected messageOptions: MessageOptions; diff --git a/src/lib/common/Format.ts b/src/lib/common/Format.ts index ba1ee9f..2557b17 100644 --- a/src/lib/common/Format.ts +++ b/src/lib/common/Format.ts @@ -1,5 +1,5 @@ +import { type CodeBlockLang } from '@lib'; import { Formatters, Util } from 'discord.js'; -import { CodeBlockLang } from './typings/CodeBlockLang'; /** * Formats and escapes content for formatting diff --git a/src/lib/common/Moderation.ts b/src/lib/common/Moderation.ts index 0c7c21a..d0367d5 100644 --- a/src/lib/common/Moderation.ts +++ b/src/lib/common/Moderation.ts @@ -1,14 +1,14 @@ -import { Snowflake } from 'discord-api-types'; import { ActivePunishment, ActivePunishmentType, - BushGuildMember, - BushGuildMemberResolvable, - BushGuildResolvable, Guild, ModLog, - ModLogType -} from '..'; + ModLogType, + type BushGuildMember, + type BushGuildMemberResolvable, + type BushGuildResolvable +} from '@lib'; +import { type Snowflake } from 'discord.js'; export class Moderation { /** diff --git a/src/lib/common/typings/BushInspectOptions.d.ts b/src/lib/common/typings/BushInspectOptions.d.ts index c2a2360..11c2dc1 100644 --- a/src/lib/common/typings/BushInspectOptions.d.ts +++ b/src/lib/common/typings/BushInspectOptions.d.ts @@ -1,4 +1,4 @@ -import { InspectOptions } from 'util'; +import { type InspectOptions } from 'util'; /** * {@link https://nodejs.org/api/util.html#util_util_inspect_object_options} diff --git a/src/lib/common/util/Arg.ts b/src/lib/common/util/Arg.ts index d267eb9..3c8e642 100644 --- a/src/lib/common/util/Arg.ts +++ b/src/lib/common/util/Arg.ts @@ -1,6 +1,6 @@ -import { AkairoMessage, Argument, ArgumentTypeCaster, Flag, ParsedValuePredicate } from 'discord-akairo'; -import { Message } from 'discord.js'; -import { BushArgumentType } from '../..'; +import { type BushArgumentType, type BushMessage, type BushSlashMessage } from '@lib'; +import { Argument, type ArgumentTypeCaster, type Flag, type ParsedValuePredicate } from 'discord-akairo'; +import { type Message } from 'discord.js'; export class Arg { /** @@ -9,7 +9,7 @@ export class Arg { * @param message - Message that called the command. * @param phrase - Phrase to process. */ - public static cast(type: BushArgumentType, message: Message | AkairoMessage, phrase: string): Promise { + public static cast(type: BushArgumentType, message: BushMessage | BushSlashMessage, phrase: string): Promise { return Argument.cast(type, client.commandHandler.resolver, message as Message, phrase); } diff --git a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts index 42d989c..c07644c 100644 --- a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts +++ b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts @@ -1,3 +1,3 @@ -import { BushMessage } from '../discord.js/BushMessage'; +import { type BushMessage } from '@lib'; export type BushArgumentTypeCaster = (message: BushMessage, phrase: string) => any; diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index c5d05b7..8f7533c 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -1,21 +1,20 @@ import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { - Awaitable, - Collection, - Intents, - InteractionReplyOptions, - Message, - MessageEditOptions, - MessageOptions, - MessagePayload, - Options, - PartialDMChannel, - ReplyMessageOptions, - Snowflake, - Structures, - version as discordJsVersion, - WebhookEditMessageOptions + DMChannel, + Intents, Options, + Structures, version as discordJsVersion, + type Awaitable, + type Collection, + type InteractionReplyOptions, + type Message, + type MessageEditOptions, + type MessageOptions, + type MessagePayload, + type PartialDMChannel, + type ReplyMessageOptions, + type Snowflake, + type WebhookEditMessageOptions } from 'discord.js'; //@ts-ignore: no typings import eventsIntercept from 'events-intercept'; @@ -89,7 +88,7 @@ export type BushThreadMemberResolvable = BushThreadMember | BushUserResolvable; export type BushUserResolvable = BushUser | Snowflake | BushMessage | BushGuildMember | BushThreadMember; export type BushGuildMemberResolvable = BushGuildMember | BushUserResolvable; export type BushRoleResolvable = BushRole | Snowflake; -export type BushMessageResolvable = BushMessage | Snowflake; +export type BushMessageResolvable = Message| BushMessage | Snowflake; export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji; export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; @@ -97,7 +96,7 @@ export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflak export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; export type BushChannelResolvable = BushChannel | Snowflake; export type BushTextBasedChannels = PartialDMChannel | BushDMChannel | BushTextChannel | BushNewsChannel | BushThreadChannel; -export type BushGuildTextBasedChannel = Exclude; +export type BushGuildTextBasedChannel = Exclude; export interface BushFetchedThreads { threads: Collection; hasMore?: boolean; diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 32081ed..4507458 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -1,31 +1,32 @@ import { - BushCache, - BushClient, + Arg, BushConstants, - BushMessage, - BushSlashMessage, - BushUser, Global, - Pronoun, - PronounCode + type BushCache, + type BushClient, + type BushMessage, + type BushSlashMessage, + type BushUser, + type Pronoun, + type PronounCode } from '@lib'; import { exec } from 'child_process'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; import { APIMessage } from 'discord-api-types'; import { - ColorResolvable, - CommandInteraction, GuildMember, - InteractionReplyOptions, Message, MessageEmbed, - PermissionResolvable, - Snowflake, - TextChannel, ThreadMember, User, - UserResolvable, - Util as DiscordUtil + Util as DiscordUtil, + type ColorResolvable, + type CommandInteraction, + type InteractionReplyOptions, + type PermissionResolvable, + type Snowflake, + type TextChannel, + type UserResolvable } from 'discord.js'; import got from 'got'; import humanizeDuration from 'humanize-duration'; @@ -36,7 +37,6 @@ import CommandErrorListener from '../../../listeners/commands/commandError'; import { Format } from '../../common/Format'; import { BushInspectOptions } from '../../common/typings/BushInspectOptions'; import { CodeBlockLang } from '../../common/typings/CodeBlockLang'; -import { Arg } from '../../common/util/Arg'; import { BushNewsChannel } from '../discord.js/BushNewsChannel'; import { BushTextChannel } from '../discord.js/BushTextChannel'; import { BushSlashEditMessageType, BushSlashSendMessageType, BushUserResolvable } from './BushClient'; @@ -401,7 +401,7 @@ export class BushClientUtil extends ClientUtil { /** * Add or remove an item from an array. All duplicates will be removed. */ - public addOrRemoveFromArray(action: 'add' | 'remove', array: T[], value: T): T[] { + public addOrRemoveFromArray(action: 'add' | 'remove', array: T[], value: T): T[] { const set = new Set(array); action === 'add' ? set.add(value) : set.delete(value); return [...set]; diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index e3066aa..40c5974 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,9 +1,6 @@ -import { ArgumentOptions, ArgumentPromptOptions, ArgumentTypeCaster, Command, CommandOptions } from 'discord-akairo'; -import { PermissionResolvable, Snowflake } from 'discord.js'; -import { BushMessage } from '../discord.js/BushMessage'; -import { BushClient } from './BushClient'; -import { BushCommandHandler } from './BushCommandHandler'; -import { BushSlashMessage } from './BushSlashMessage'; +import { type BushClient, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '@lib'; +import { Command, type ArgumentOptions, type ArgumentPromptOptions, type ArgumentTypeCaster, type CommandOptions } from 'discord-akairo'; +import { type PermissionResolvable, type Snowflake } from 'discord.js'; export type BaseBushArgumentType = | 'string' diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts index 8ab47d8..09cb303 100644 --- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts +++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts @@ -1,9 +1,6 @@ -import { Category, CommandHandler, CommandHandlerEvents, CommandHandlerOptions } from 'discord-akairo'; -import { Collection, PermissionString } from 'discord.js'; -import { BushMessage } from '../discord.js/BushMessage'; -import { BushClient } from './BushClient'; -import { BushCommand } from './BushCommand'; -import { BushSlashMessage } from './BushSlashMessage'; +import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '@lib'; +import { CommandHandler, type Category, type CommandHandlerEvents, type CommandHandlerOptions } from 'discord-akairo'; +import { type Collection, type PermissionString } from 'discord.js'; export type BushCommandHandlerOptions = CommandHandlerOptions; diff --git a/src/lib/extensions/discord-akairo/BushCommandUtil.ts b/src/lib/extensions/discord-akairo/BushCommandUtil.ts index 7720d57..04533bd 100644 --- a/src/lib/extensions/discord-akairo/BushCommandUtil.ts +++ b/src/lib/extensions/discord-akairo/BushCommandUtil.ts @@ -1,10 +1,6 @@ -import { CommandUtil, ParsedComponentData } from 'discord-akairo'; -import { Snowflake } from 'discord-api-types'; -import { Collection } from 'discord.js'; -import { BushMessage } from '../discord.js/BushMessage'; -import { BushCommand } from './BushCommand'; -import { BushCommandHandler } from './BushCommandHandler'; -import { BushSlashMessage } from './BushSlashMessage'; +import { type BushCommand, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '@lib'; +import { CommandUtil, type ParsedComponentData } from 'discord-akairo'; +import { type Collection, type Snowflake } from 'discord.js'; export interface BushParsedComponentData extends ParsedComponentData { command?: BushCommand; diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts index d689a72..638f663 100644 --- a/src/lib/extensions/discord-akairo/BushInhibitor.ts +++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts @@ -1,8 +1,5 @@ +import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '@lib'; import { Inhibitor } from 'discord-akairo'; -import { BushMessage } from '../discord.js/BushMessage'; -import { BushClient } from './BushClient'; -import { BushCommand } from './BushCommand'; -import { BushSlashMessage } from './BushSlashMessage'; export class BushInhibitor extends Inhibitor { public declare client: BushClient; diff --git a/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts b/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts index 2a947da..4984934 100644 --- a/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts +++ b/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts @@ -1,5 +1,5 @@ +import { type BushClient } from '@lib'; import { InhibitorHandler } from 'discord-akairo'; -import { BushClient } from './BushClient'; export class BushInhibitorHandler extends InhibitorHandler { public declare client: BushClient; diff --git a/src/lib/extensions/discord-akairo/BushListener.ts b/src/lib/extensions/discord-akairo/BushListener.ts index 82e874f..e3c845c 100644 --- a/src/lib/extensions/discord-akairo/BushListener.ts +++ b/src/lib/extensions/discord-akairo/BushListener.ts @@ -1,6 +1,7 @@ +import { type BushClient } from '@lib'; import { Listener } from 'discord-akairo'; -import EventEmitter from 'events'; -import { BushClient } from './BushClient'; +import type EventEmitter from 'events'; + export class BushListener extends Listener { public declare client: BushClient; public constructor( diff --git a/src/lib/extensions/discord-akairo/BushListenerHandler.ts b/src/lib/extensions/discord-akairo/BushListenerHandler.ts index 28615fc..f5354e4 100644 --- a/src/lib/extensions/discord-akairo/BushListenerHandler.ts +++ b/src/lib/extensions/discord-akairo/BushListenerHandler.ts @@ -1,5 +1,5 @@ +import { type BushClient } from '@lib'; import { ListenerHandler } from 'discord-akairo'; -import { BushClient } from './BushClient'; export class BushListenerHandler extends ListenerHandler { declare client: BushClient; diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts index b5e48ea..fd248b1 100644 --- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts +++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts @@ -1,10 +1,6 @@ +import { type BushClient, type BushCommandUtil, type BushGuild, type BushGuildMember, type BushUser } from '@lib'; import { AkairoMessage } from 'discord-akairo'; -import { CommandInteraction } from 'discord.js'; -import { BushGuild } from '../discord.js/BushGuild'; -import { BushGuildMember } from '../discord.js/BushGuildMember'; -import { BushUser } from '../discord.js/BushUser'; -import { BushClient } from './BushClient'; -import { BushCommandUtil } from './BushCommandUtil'; +import { type CommandInteraction } from 'discord.js'; export class BushSlashMessage extends AkairoMessage { public declare client: BushClient; diff --git a/src/lib/extensions/discord-akairo/BushTask.ts b/src/lib/extensions/discord-akairo/BushTask.ts index 1b14a2b..299e977 100644 --- a/src/lib/extensions/discord-akairo/BushTask.ts +++ b/src/lib/extensions/discord-akairo/BushTask.ts @@ -1,5 +1,5 @@ -import { Task, TaskOptions } from 'discord-akairo'; -import { BushClient } from './BushClient'; +import { type BushClient } from '@lib'; +import { Task, type TaskOptions } from 'discord-akairo'; export class BushTask extends Task { public declare client: BushClient; diff --git a/src/lib/extensions/discord-akairo/BushTaskHandler.ts b/src/lib/extensions/discord-akairo/BushTaskHandler.ts index 588988d..8531ff1 100644 --- a/src/lib/extensions/discord-akairo/BushTaskHandler.ts +++ b/src/lib/extensions/discord-akairo/BushTaskHandler.ts @@ -1,5 +1,5 @@ -import { AkairoHandlerOptions, TaskHandler } from 'discord-akairo'; -import { BushClient } from './BushClient'; +import { type BushClient } from '@lib'; +import { TaskHandler, type AkairoHandlerOptions } from 'discord-akairo'; export type BushTaskHandlerOptions = AkairoHandlerOptions; diff --git a/src/lib/extensions/discord.js/BushActivity.ts b/src/lib/extensions/discord.js/BushActivity.ts index 96c924d..1da5fac 100644 --- a/src/lib/extensions/discord.js/BushActivity.ts +++ b/src/lib/extensions/discord.js/BushActivity.ts @@ -1,7 +1,6 @@ +import { type BushEmoji, type BushPresence } from '@lib'; import { Activity } from 'discord.js'; -import { RawActivityData } from 'discord.js/typings/rawDataTypes'; -import { BushEmoji } from './BushEmoji'; -import { BushPresence } from './BushPresence'; +import { type RawActivityData } from 'discord.js/typings/rawDataTypes'; export class BushActivity extends Activity { public declare emoji: BushEmoji | null; diff --git a/src/lib/extensions/discord.js/BushApplicationCommand.ts b/src/lib/extensions/discord.js/BushApplicationCommand.ts index 0d7c000..9dfba65 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommand.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommand.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/ban-types */ -import { ApplicationCommand, Snowflake } from 'discord.js'; -import { RawApplicationCommandData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; +import { type BushClient, type BushGuild } from '@lib'; +import { ApplicationCommand, type Snowflake } from 'discord.js'; +import { type RawApplicationCommandData } from 'discord.js/typings/rawDataTypes'; export class BushApplicationCommand extends ApplicationCommand { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts index b993215..89ad55d 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts @@ -1,9 +1,12 @@ -import { APIApplicationCommand } from 'discord-api-types'; -import { ApplicationCommandData, CachedManager, Collection, FetchApplicationCommandOptions, Snowflake } from 'discord.js'; -import { BushApplicationCommandResolvable, BushClient } from '../discord-akairo/BushClient'; -import { BushApplicationCommand } from './BushApplicationCommand'; -import { BushApplicationCommandPermissionsManager } from './BushApplicationCommandPermissionsManager'; -import { BushGuildResolvable } from './BushCommandInteraction'; +import { + type BushApplicationCommand, + type BushApplicationCommandPermissionsManager, + type BushApplicationCommandResolvable, + type BushClient, + type BushGuildResolvable +} from '@lib'; +import { type APIApplicationCommand } from 'discord-api-types'; +import { CachedManager, type ApplicationCommandData, type Collection, type FetchApplicationCommandOptions, type Snowflake } from 'discord.js'; export class BushApplicationCommandManager< ApplicationCommandScope = BushApplicationCommand<{ guild: BushGuildResolvable }>, @@ -29,6 +32,7 @@ export class BushApplicationCommandManager< guildId: Snowflake ): Promise; public fetch(id: Snowflake, options: FetchApplicationCommandOptions & { guildId: Snowflake }): Promise; + public fetch(options: FetchApplicationCommandOptions): Promise>; public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise; public fetch(id?: Snowflake, options?: FetchApplicationCommandOptions): Promise>; public set(commands: ApplicationCommandData[]): Promise>; diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts index ece4a60..0fd47ac 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts @@ -1,17 +1,16 @@ -import { APIApplicationCommandPermission } from 'discord-api-types'; +import { type BushClient, type BushRoleResolvable, type BushUserResolvable } from '@lib'; +import { type APIApplicationCommandPermission } from 'discord-api-types'; import { - ApplicationCommand, - ApplicationCommandManager, - ApplicationCommandPermissionData, - ApplicationCommandPermissions, - BaseManager, - Collection, - GuildApplicationCommandManager, - GuildApplicationCommandPermissionData, - Snowflake + BaseManager, type ApplicationCommand, + type ApplicationCommandManager, + type ApplicationCommandPermissionData, + type ApplicationCommandPermissions, + type Collection, + type GuildApplicationCommandManager, + type GuildApplicationCommandPermissionData, + type Snowflake } from 'discord.js'; -import { ApplicationCommandPermissionTypes } from 'discord.js/typings/enums'; -import { BushClient, BushRoleResolvable, BushUserResolvable } from '../discord-akairo/BushClient'; +import { type ApplicationCommandPermissionTypes } from 'discord.js/typings/enums'; export class BushApplicationCommandPermissionsManager< BaseOptions, diff --git a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts index 3e00d96..b3704b6 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts @@ -1,8 +1,6 @@ -import { Snowflake } from 'discord-api-types'; -import { CachedManager } from 'discord.js'; -import { RawGuildEmojiData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushEmojiIdentifierResolvable, BushEmojiResolvable } from '../discord-akairo/BushClient'; -import { BushGuildEmoji } from './BushGuildEmoji'; +import { type BushClient, type BushEmojiIdentifierResolvable, type BushEmojiResolvable, type BushGuildEmoji } from '@lib'; +import { CachedManager, type Snowflake } from 'discord.js'; +import { type RawGuildEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushBaseGuildEmojiManager extends CachedManager { public constructor(client: BushClient, iterable?: Iterable); diff --git a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts index 78cfada..38a8a7d 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts @@ -1,15 +1,19 @@ import { - AllowedThreadTypeForNewsChannel, - AllowedThreadTypeForTextChannel, + type BushCategoryChannel, + type BushClient, + type BushGuild, + type BushGuildMember, + type BushMessageManager, + type BushThreadManager +} from '@lib'; +import { BaseGuildTextChannel, - Collection, - Snowflake + type AllowedThreadTypeForNewsChannel, + type AllowedThreadTypeForTextChannel, + type Collection, + type Snowflake } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushCategoryChannel, BushClient, BushGuildMember } from '../..'; -import { BushGuild } from './BushGuild'; -import { BushMessageManager } from './BushMessageManager'; -import { BushThreadManager } from './BushThreadManager'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushBaseGuildTextChannel extends BaseGuildTextChannel { public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index 26b98f6..2146e5c 100644 --- a/src/lib/extensions/discord.js/BushButtonInteraction.ts +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -1,13 +1,10 @@ -import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { ButtonInteraction, CacheType, CacheTypeReducer } from 'discord.js'; -import { RawMessageButtonInteractionData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushUser } from './BushUser'; +import { type BushClient, type BushGuild, type BushGuildMember, type BushTextBasedChannels, type BushUser } from '@lib'; +import { type APIInteractionGuildMember } from 'discord-api-types/v9'; +import { ButtonInteraction, type CacheType, type CacheTypeReducer } from 'discord.js'; +import { type RawMessageButtonInteractionData } from 'discord.js/typings/rawDataTypes'; export class BushButtonInteraction extends ButtonInteraction { - public declare readonly channel: BushTextBasedChannels | null; + public declare readonly channel: CacheTypeReducer; public declare readonly guild: CacheTypeReducer; public declare member: CacheTypeReducer; public declare user: BushUser; diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts index f5d26f0..a97c21b 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannel.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts @@ -1,9 +1,6 @@ -import { CategoryChannel, Collection, Snowflake } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildChannel } from './BushGuildChannel'; -import { BushGuildMember } from './BushGuildMember'; +import { type BushClient, type BushGuild, type BushGuildChannel, type BushGuildMember } from '@lib'; +import { CategoryChannel, type Collection, type Snowflake } from 'discord.js'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushCategoryChannel extends CategoryChannel { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushChannel.d.ts b/src/lib/extensions/discord.js/BushChannel.d.ts index 2e465a5..1c47018 100644 --- a/src/lib/extensions/discord.js/BushChannel.d.ts +++ b/src/lib/extensions/discord.js/BushChannel.d.ts @@ -1,11 +1,7 @@ -import { Snowflake } from 'discord-api-types'; -import { Channel, ChannelMention } from 'discord.js'; -import { ChannelTypes } from 'discord.js/typings/enums'; -import { RawChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; -import { BushStageChannel } from './BushStageChannel'; -import { BushThreadChannel } from './BushThreadChannel'; -import { BushVoiceChannel } from './BushVoiceChannel'; +import { type BushClient, type BushStageChannel, type BushTextBasedChannels, type BushThreadChannel, type BushVoiceChannel } from '@lib'; +import { Channel, type ChannelMention, type Snowflake } from 'discord.js'; +import { type ChannelTypes } from 'discord.js/typings/enums'; +import { type RawChannelData } from 'discord.js/typings/rawDataTypes'; export class BushChannel extends Channel { public constructor(client: BushClient, data?: RawChannelData, immediatePatch?: boolean); diff --git a/src/lib/extensions/discord.js/BushChannelManager.d.ts b/src/lib/extensions/discord.js/BushChannelManager.d.ts index 924f5b6..7ebeb79 100644 --- a/src/lib/extensions/discord.js/BushChannelManager.d.ts +++ b/src/lib/extensions/discord.js/BushChannelManager.d.ts @@ -1,8 +1,6 @@ -import { Snowflake } from 'discord-api-types'; -import { CachedManager, Client, FetchChannelOptions } from 'discord.js'; -import { RawChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushChannelResolvable } from '../discord-akairo/BushClient'; -import { BushChannel } from './BushChannel'; +import { type BushChannel, type BushChannelResolvable } from '@lib'; +import { CachedManager, type Client, type FetchChannelOptions, type Snowflake } from 'discord.js'; +import { type RawChannelData } from 'discord.js/typings/rawDataTypes'; export class BushChannelManager extends CachedManager { public constructor(client: Client, iterable: Iterable); diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.d.ts index b16f632..3e9fbf9 100644 --- a/src/lib/extensions/discord.js/BushClientEvents.d.ts +++ b/src/lib/extensions/discord.js/BushClientEvents.d.ts @@ -1,42 +1,42 @@ import { - BushApplicationCommand, - BushClient, - BushDMChannel, - BushGuild, - BushGuildChannel, - BushGuildEmoji, - BushGuildMember, - BushMessage, - BushMessageReaction, - BushNewsChannel, - BushPresence, - BushRole, - BushStageInstance, - BushTextBasedChannels, - BushTextChannel, - BushThreadChannel, - BushThreadMember, - BushUser, - BushVoiceState, - Guild, - GuildSettings, - PartialBushGuildMember, - PartialBushMessage, - PartialBushMessageReaction, - PartialBushUser + type BushApplicationCommand, + type BushClient, + type BushDMChannel, + type BushGuild, + type BushGuildBan, + type BushGuildChannel, + type BushGuildEmoji, + type BushGuildMember, + type BushMessage, + type BushMessageReaction, + type BushNewsChannel, + type BushPresence, + type BushRole, + type BushStageInstance, + type BushTextBasedChannels, + type BushTextChannel, + type BushThreadChannel, + type BushThreadMember, + type BushUser, + type BushVoiceState, + type Guild, + type GuildSettings, + type PartialBushGuildMember, + type PartialBushMessage, + type PartialBushMessageReaction, + type PartialBushUser } from '@lib'; -import { AkairoClientEvents } from 'discord-akairo'; +import { type AkairoClientEvents } from 'discord-akairo'; import { - Collection, - Interaction, - InvalidRequestWarningData, - Invite, - RateLimitData, - Snowflake, - Sticker, - Typing + type Collection, + type Interaction, + type InvalidRequestWarningData, + type Invite, + type RateLimitData, + type Snowflake, + type Sticker, + type Typing } from 'discord.js'; -import { BushGuildBan } from './BushGuildBan'; export interface BushClientEvents extends AkairoClientEvents { applicationCommandCreate: [command: BushApplicationCommand]; diff --git a/src/lib/extensions/discord.js/BushClientUser.d.ts b/src/lib/extensions/discord.js/BushClientUser.d.ts index 1a6cea4..b045a75 100644 --- a/src/lib/extensions/discord.js/BushClientUser.d.ts +++ b/src/lib/extensions/discord.js/BushClientUser.d.ts @@ -1,11 +1,11 @@ import { - ActivityOptions, - Base64Resolvable, - BufferResolvable, - ClientPresence, - ClientUserEditData, - PresenceData, - PresenceStatusData + type ActivityOptions, + type Base64Resolvable, + type BufferResolvable, + type ClientPresence, + type ClientUserEditData, + type PresenceData, + type PresenceStatusData } from 'discord.js'; import { BushUser } from './BushUser'; diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushCommandInteraction.ts index eff3b45..4202cfd 100644 --- a/src/lib/extensions/discord.js/BushCommandInteraction.ts +++ b/src/lib/extensions/discord.js/BushCommandInteraction.ts @@ -1,14 +1,16 @@ -import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { CacheType, CacheTypeReducer, CommandInteraction, Invite, Snowflake } from 'discord.js'; -import { RawCommandInteractionData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; -import { BushApplicationCommand } from './BushApplicationCommand'; -import { BushGuild } from './BushGuild'; -import { BushGuildChannel } from './BushGuildChannel'; -import { BushGuildEmoji } from './BushGuildEmoji'; -import { BushGuildMember } from './BushGuildMember'; -import { BushRole } from './BushRole'; -import { BushUser } from './BushUser'; +import { + type BushApplicationCommand, + type BushGuild, + type BushGuildChannel, + type BushGuildEmoji, + type BushGuildMember, + type BushRole, + type BushUser +} from '@lib'; +import { type APIInteractionGuildMember } from 'discord-api-types/v9'; +import { CommandInteraction, type CacheType, type CacheTypeReducer, type Invite, type Snowflake } from 'discord.js'; +import { type RawCommandInteractionData } from 'discord.js/typings/rawDataTypes'; +import { BushTextBasedChannels, type BushClient } from '../discord-akairo/BushClient'; export type BushGuildResolvable = BushGuild | BushGuildChannel | BushGuildMember | BushGuildEmoji | Invite | BushRole | Snowflake; @@ -18,7 +20,7 @@ export class BushCommandInteraction extend } public declare readonly client: BushClient; public declare readonly command: BushApplicationCommand | BushApplicationCommand<{ guild: BushGuildResolvable }> | null; - public declare readonly channel: BushTextBasedChannels | null; + public declare readonly channel: CacheTypeReducer; public declare readonly guild: CacheTypeReducer; public declare member: CacheTypeReducer; public declare user: BushUser; diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts index 4b44f83..9730c30 100644 --- a/src/lib/extensions/discord.js/BushDMChannel.ts +++ b/src/lib/extensions/discord.js/BushDMChannel.ts @@ -1,8 +1,6 @@ +import { type BushClient, type BushMessageManager, type BushUser } from '@lib'; import { DMChannel } from 'discord.js'; -import { RawDMChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushMessageManager } from './BushMessageManager'; -import { BushUser } from './BushUser'; +import { type RawDMChannelData } from 'discord.js/typings/rawDataTypes'; export class BushDMChannel extends DMChannel { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushEmoji.ts b/src/lib/extensions/discord.js/BushEmoji.ts index db1cc11..fc27a99 100644 --- a/src/lib/extensions/discord.js/BushEmoji.ts +++ b/src/lib/extensions/discord.js/BushEmoji.ts @@ -1,6 +1,6 @@ +import { type BushClient } from '@lib'; import { Emoji } from 'discord.js'; -import { RawEmojiData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; +import { type RawEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushEmoji extends Emoji { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 487ff9a..dff9d85 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -1,13 +1,19 @@ -import { Guild, MessageOptions, UserResolvable } from 'discord.js'; -import { RawGuildData } from 'discord.js/typings/rawDataTypes'; +import { + type BushClient, + type BushGuildMember, + type BushGuildMemberManager, + type BushTextChannel, + type BushUser, + type BushUserResolvable, + type GuildFeatures, + type GuildLogType, + type GuildModel +} from '@lib'; +import { Guild, type MessageOptions, type UserResolvable } from 'discord.js'; +import { type RawGuildData } from 'discord.js/typings/rawDataTypes'; import { Moderation } from '../../common/Moderation'; -import { Guild as GuildDB, GuildFeatures, GuildLogType, GuildModel } from '../../models/Guild'; +import { Guild as GuildDB } from '../../models/Guild'; import { ModLogType } from '../../models/ModLog'; -import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; -import { BushGuildMember } from './BushGuildMember'; -import { BushGuildMemberManager } from './BushGuildMemberManager'; -import { BushTextChannel } from './BushTextChannel'; -import { BushUser } from './BushUser'; export class BushGuild extends Guild { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts index 38afa94..3c71a01 100644 --- a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts @@ -1,10 +1,13 @@ /* eslint-disable @typescript-eslint/ban-types */ -import { ApplicationCommandData, BaseFetchOptions, Collection, Snowflake } from 'discord.js'; -import { RawApplicationCommandData } from 'discord.js/typings/rawDataTypes'; -import { BushApplicationCommandResolvable, BushClient } from '../discord-akairo/BushClient'; -import { BushApplicationCommand } from './BushApplicationCommand'; -import { BushApplicationCommandManager } from './BushApplicationCommandManager'; -import { BushGuild } from './BushGuild'; +import { + BushApplicationCommandManager, + type BushApplicationCommand, + type BushApplicationCommandResolvable, + type BushClient, + type BushGuild +} from '@lib'; +import { type ApplicationCommandData, type BaseFetchOptions, type Collection, type Snowflake } from 'discord.js'; +import { type RawApplicationCommandData } from 'discord.js/typings/rawDataTypes'; export class BushGuildApplicationCommandManager extends BushApplicationCommandManager { public constructor(guild: BushGuild, iterable?: Iterable); @@ -14,6 +17,7 @@ export class BushGuildApplicationCommandManager extends BushApplicationCommandMa public delete(command: BushApplicationCommandResolvable): Promise; public edit(command: BushApplicationCommandResolvable, data: ApplicationCommandData): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; + public fetch(options: BaseFetchOptions): Promise>; public fetch(id?: undefined, options?: BaseFetchOptions): Promise>; public set(commands: ApplicationCommandData[]): Promise>; } diff --git a/src/lib/extensions/discord.js/BushGuildBan.d.ts b/src/lib/extensions/discord.js/BushGuildBan.d.ts index 0174220..5d50bb4 100644 --- a/src/lib/extensions/discord.js/BushGuildBan.d.ts +++ b/src/lib/extensions/discord.js/BushGuildBan.d.ts @@ -1,8 +1,6 @@ +import { type BushClient, type BushGuild, type BushUser } from '@lib'; import { GuildBan } from 'discord.js'; -import { RawGuildBanData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushUser } from './BushUser'; +import { type RawGuildBanData } from 'discord.js/typings/rawDataTypes'; export class BushGuildBan extends GuildBan { public constructor(client: BushClient, data: RawGuildBanData, guild: BushGuild); diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts index 7daa80d..ee51c3b 100644 --- a/src/lib/extensions/discord.js/BushGuildChannel.ts +++ b/src/lib/extensions/discord.js/BushGuildChannel.ts @@ -1,7 +1,6 @@ +import { type BushClient, type BushGuild } from '@lib'; import { GuildChannel } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushGuildChannel extends GuildChannel { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushGuildEmoji.ts b/src/lib/extensions/discord.js/BushGuildEmoji.ts index 0ac5ebd..8d5493b 100644 --- a/src/lib/extensions/discord.js/BushGuildEmoji.ts +++ b/src/lib/extensions/discord.js/BushGuildEmoji.ts @@ -1,9 +1,6 @@ +import { type BushClient, type BushGuild, type BushGuildEmojiRoleManager, type BushUser } from '@lib'; import { GuildEmoji } from 'discord.js'; -import { RawGuildEmojiData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildEmojiRoleManager } from './BushGuildEmojiRoleManager'; -import { BushUser } from './BushUser'; +import { type RawGuildEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushGuildEmoji extends GuildEmoji { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts index 6e36292..8b886bd 100644 --- a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts @@ -1,8 +1,5 @@ -import { Collection, DataManager, Snowflake } from 'discord.js'; -import { BushClient, BushRoleResolvable } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildEmoji } from './BushGuildEmoji'; -import { BushRole } from './BushRole'; +import { type BushClient, type BushGuild, type BushGuildEmoji, type BushRole, type BushRoleResolvable } from '@lib'; +import { DataManager, type Collection, type Snowflake } from 'discord.js'; export class BushGuildEmojiRoleManager extends DataManager { public constructor(emoji: BushGuildEmoji); diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.d.ts index 4ec9276..1a56b8f 100644 --- a/src/lib/extensions/discord.js/BushGuildManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildManager.d.ts @@ -1,9 +1,13 @@ -import { Snowflake } from 'discord-api-types'; -import { CachedManager, Collection, FetchGuildOptions, FetchGuildsOptions, GuildCreateOptions, OAuth2Guild } from 'discord.js'; -import { RawGuildData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuildResolvable } from './BushCommandInteraction'; -import { BushGuild } from './BushGuild'; +import { type BushClient, type BushGuild, type BushGuildResolvable } from '@lib'; +import { + CachedManager, + type Collection, + type FetchGuildOptions, + type FetchGuildsOptions, type GuildCreateOptions, + type OAuth2Guild, + type Snowflake +} from 'discord.js'; +import { type RawGuildData } from 'discord.js/typings/rawDataTypes'; export class BushGuildManager extends CachedManager { public constructor(client: BushClient, iterable?: Iterable); diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index b23ff33..32f0156 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -1,11 +1,6 @@ -import { GuildMember, MessageEmbed, Partialize, Role } from 'discord.js'; -import { RawGuildMemberData } from 'discord.js/typings/rawDataTypes'; -import { Moderation } from '../../common/Moderation'; -import { ModLogType } from '../../models/ModLog'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushRole } from './BushRole'; -import { BushUser } from './BushUser'; +import { Moderation, ModLogType, type BushClient, type BushGuild, type BushRole, type BushUser } from '@lib'; +import { GuildMember, MessageEmbed, type Partialize, type Role } from 'discord.js'; +import { type RawGuildMemberData } from 'discord.js/typings/rawDataTypes'; interface BushPunishmentOptions { reason?: string | null; diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts index e868b10..f5e0846 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts @@ -1,21 +1,25 @@ import { - AddGuildMemberOptions, - BanOptions, + type BushClient, + type BushGuild, + type BushGuildMember, + type BushGuildMemberResolvable, + type BushUser, + type BushUserResolvable +} from '@lib'; +import { CachedManager, - Collection, - FetchMemberOptions, - FetchMembersOptions, - GuildListMembersOptions, - GuildMemberEditData, - GuildPruneMembersOptions, - GuildSearchMembersOptions, - Snowflake + type AddGuildMemberOptions, + type BanOptions, + type Collection, + type FetchMemberOptions, + type FetchMembersOptions, + type GuildListMembersOptions, + type GuildMemberEditData, + type GuildPruneMembersOptions, + type GuildSearchMembersOptions, + type Snowflake } from 'discord.js'; -import { RawGuildMemberData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushGuildMemberResolvable, BushUserResolvable } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushUser } from './BushUser'; +import { type RawGuildMemberData } from 'discord.js/typings/rawDataTypes'; export class BushGuildMemberManager extends CachedManager { public constructor(guild: BushGuild, iterable?: Iterable); diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 941df29..d64ac6e 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -1,10 +1,14 @@ -import { If, Message, Partialize } from 'discord.js'; -import { RawMessageData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushGuildTextBasedChannel, BushTextBasedChannels } from '../discord-akairo/BushClient'; -import { BushCommandUtil } from '../discord-akairo/BushCommandUtil'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushUser } from './BushUser'; +import { + type BushClient, + type BushCommandUtil, + type BushGuild, + type BushGuildMember, + type BushGuildTextBasedChannel, + type BushTextBasedChannels, + type BushUser +} from '@lib'; +import { Message, type If, type Partialize } from 'discord.js'; +import { type RawMessageData } from 'discord.js/typings/rawDataTypes'; export type PartialBushMessage = Partialize< BushMessage, @@ -13,14 +17,13 @@ export type PartialBushMessage = Partialize< >; export class BushMessage extends Message { public declare readonly client: BushClient; - public override util!: BushCommandUtil; + public declare util: BushCommandUtil>; public declare readonly guild: BushGuild | null; public declare readonly member: BushGuildMember | null; public declare author: BushUser; public declare readonly channel: If; public constructor(client: BushClient, data: RawMessageData) { super(client, data); - // this.util = new BushCommandUtil(client.commandHandler, this); } public override fetch(force?: boolean): Promise { return super.fetch(force) as Promise; diff --git a/src/lib/extensions/discord.js/BushMessageManager.d.ts b/src/lib/extensions/discord.js/BushMessageManager.d.ts index 8495130..98a24d8 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.d.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.d.ts @@ -1,29 +1,25 @@ +import { BushMessageResolvable, type BushMessage, type BushTextBasedChannels } from '@lib'; import { - BaseFetchOptions, - CachedManager, - ChannelLogsQueryOptions, - Collection, - EmojiIdentifierResolvable, - MessageEditOptions, - MessagePayload, - MessageResolvable, - Snowflake + CachedManager, type BaseFetchOptions, + type ChannelLogsQueryOptions, + type Collection, + type EmojiIdentifierResolvable, + type MessageEditOptions, + type MessagePayload, type Snowflake } from 'discord.js'; -import { RawMessageData } from 'discord.js/typings/rawDataTypes'; -import { BushMessageResolvable, BushTextBasedChannels } from '../..'; -import { BushMessage } from './BushMessage'; +import { type RawMessageData } from 'discord.js/typings/rawDataTypes'; export class BushMessageManager extends CachedManager { - public constructor(channel: BushTextBasedChannels, iterable?: Iterable); - public channel: BushTextBasedChannels; - public cache: Collection; - public crosspost(message: BushMessageResolvable): Promise; - public delete(message: BushMessageResolvable): Promise; - public edit(message: MessageResolvable, options: MessagePayload | MessageEditOptions): Promise; - public fetch(message: Snowflake, options?: BaseFetchOptions): Promise; - public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise>; - public fetchPinned(cache?: boolean): Promise>; - public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise; - public pin(message: BushMessageResolvable): Promise; - public unpin(message: BushMessageResolvable): Promise; + public constructor(channel: BushTextBasedChannels, iterable?: Iterable); + public channel: BushTextBasedChannels; + public cache: Collection; + public crosspost(message: BushMessageResolvable): Promise; + public delete(message: BushMessageResolvable): Promise; + public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise; + public fetch(message: Snowflake, options?: BaseFetchOptions): Promise; + public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise>; + public fetchPinned(cache?: boolean): Promise>; + public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise; + public pin(message: BushMessageResolvable): Promise; + public unpin(message: BushMessageResolvable): Promise; } diff --git a/src/lib/extensions/discord.js/BushMessageReaction.ts b/src/lib/extensions/discord.js/BushMessageReaction.ts index 056e4e6..b56ae28 100644 --- a/src/lib/extensions/discord.js/BushMessageReaction.ts +++ b/src/lib/extensions/discord.js/BushMessageReaction.ts @@ -1,9 +1,6 @@ -import { MessageReaction, Partialize } from 'discord.js'; -import { RawMessageReactionData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuildEmoji } from './BushGuildEmoji'; -import { BushMessage } from './BushMessage'; -import { BushReactionEmoji } from './BushReactionEmoji'; +import { type BushClient, type BushGuildEmoji, type BushMessage, type BushReactionEmoji } from '@lib'; +import { MessageReaction, type Partialize } from 'discord.js'; +import { type RawMessageReactionData } from 'discord.js/typings/rawDataTypes'; export type PartialBushMessageReaction = Partialize; diff --git a/src/lib/extensions/discord.js/BushNewsChannel.ts b/src/lib/extensions/discord.js/BushNewsChannel.ts index d770132..f30de3e 100644 --- a/src/lib/extensions/discord.js/BushNewsChannel.ts +++ b/src/lib/extensions/discord.js/BushNewsChannel.ts @@ -1,12 +1,7 @@ -import { AllowedThreadTypeForNewsChannel, Collection, NewsChannel, Snowflake } from 'discord.js'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushMessageManager } from './BushMessageManager'; -import { BushThreadManager } from './BushThreadManager'; +import { type BushGuild, type BushGuildMember, type BushMessageManager, type BushThreadManager } from '@lib'; +import { NewsChannel, type AllowedThreadTypeForNewsChannel, type Collection, type Snowflake } from 'discord.js'; export class BushNewsChannel extends NewsChannel { - public declare readonly client: BushClient; public declare threads: BushThreadManager; public declare guild: BushGuild; public declare messages: BushMessageManager; diff --git a/src/lib/extensions/discord.js/BushPresence.ts b/src/lib/extensions/discord.js/BushPresence.ts index ff1937c..c5464a5 100644 --- a/src/lib/extensions/discord.js/BushPresence.ts +++ b/src/lib/extensions/discord.js/BushPresence.ts @@ -1,9 +1,6 @@ +import { type BushClient, type BushGuild, type BushGuildMember, type BushUser } from '@lib'; import { Presence } from 'discord.js'; -import { RawPresenceData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushUser } from './BushUser'; +import { type RawPresenceData } from 'discord.js/typings/rawDataTypes'; export class BushPresence extends Presence { public declare guild: BushGuild | null; diff --git a/src/lib/extensions/discord.js/BushReactionEmoji.ts b/src/lib/extensions/discord.js/BushReactionEmoji.ts index 3aee2fb..5dd3d92 100644 --- a/src/lib/extensions/discord.js/BushReactionEmoji.ts +++ b/src/lib/extensions/discord.js/BushReactionEmoji.ts @@ -1,10 +1,8 @@ +import { type BushMessageReaction } from '@lib'; import { ReactionEmoji } from 'discord.js'; -import { RawReactionEmojiData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushMessageReaction } from './BushMessageReaction'; +import { type RawReactionEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushReactionEmoji extends ReactionEmoji { - public declare readonly client: BushClient; public declare reaction: BushMessageReaction; public constructor(reaction: BushMessageReaction, emoji: RawReactionEmojiData) { super(reaction, emoji); diff --git a/src/lib/extensions/discord.js/BushRole.ts b/src/lib/extensions/discord.js/BushRole.ts index 084b019..b610699 100644 --- a/src/lib/extensions/discord.js/BushRole.ts +++ b/src/lib/extensions/discord.js/BushRole.ts @@ -1,11 +1,8 @@ -import { Collection, Role, Snowflake } from 'discord.js'; -import { RawRoleData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; +import { type BushClient, type BushGuild, type BushGuildMember } from '@lib'; +import { Role, type Collection, type Snowflake } from 'discord.js'; +import { type RawRoleData } from 'discord.js/typings/rawDataTypes'; export class BushRole extends Role { - public declare readonly client: BushClient; public declare guild: BushGuild; public declare readonly members: Collection; public constructor(client: BushClient, data: RawRoleData, guild: BushGuild) { diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index d4ebd4f..cffc099 100644 --- a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -1,13 +1,10 @@ -import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { CacheType, CacheTypeReducer, SelectMenuInteraction } from 'discord.js'; -import { RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushUser } from './BushUser'; +import { type BushClient, type BushGuild, type BushGuildMember, type BushTextBasedChannels, type BushUser } from '@lib'; +import { type APIInteractionGuildMember } from 'discord-api-types/v9'; +import { SelectMenuInteraction, type CacheType, type CacheTypeReducer } from 'discord.js'; +import { type RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes'; export class BushSelectMenuInteraction extends SelectMenuInteraction { - public declare readonly channel: BushTextBasedChannels | null; + public declare readonly channel: CacheTypeReducer; public declare readonly guild: CacheTypeReducer; public declare member: CacheTypeReducer; public declare user: BushUser; diff --git a/src/lib/extensions/discord.js/BushStageChannel.ts b/src/lib/extensions/discord.js/BushStageChannel.ts index 4df64e8..a5b6b53 100644 --- a/src/lib/extensions/discord.js/BushStageChannel.ts +++ b/src/lib/extensions/discord.js/BushStageChannel.ts @@ -1,13 +1,8 @@ -import { Collection, Snowflake, StageChannel } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushCategoryChannel } from './BushCategoryChannel'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushStageInstance } from './BushStageInstance'; +import { type BushCategoryChannel, type BushGuild, type BushGuildMember, type BushStageInstance } from '@lib'; +import { StageChannel, type Collection, type Snowflake } from 'discord.js'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushStageChannel extends StageChannel { - public declare readonly client: BushClient; public declare readonly instance: BushStageInstance | null; public declare readonly members: Collection; public declare guild: BushGuild; diff --git a/src/lib/extensions/discord.js/BushStageInstance.ts b/src/lib/extensions/discord.js/BushStageInstance.ts index ab09863..4ebfc3c 100644 --- a/src/lib/extensions/discord.js/BushStageInstance.ts +++ b/src/lib/extensions/discord.js/BushStageInstance.ts @@ -1,11 +1,8 @@ +import { type BushClient, type BushGuild, type BushStageChannel } from '@lib'; import { StageInstance } from 'discord.js'; -import { RawStageInstanceData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushStageChannel } from './BushStageChannel'; +import { type RawStageInstanceData } from 'discord.js/typings/rawDataTypes'; export class BushStageInstance extends StageInstance { - public declare readonly client: BushClient; public declare readonly channel: BushStageChannel | null; public declare readonly guild: BushGuild | null; public constructor(client: BushClient, data: RawStageInstanceData, channel: BushStageChannel) { diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts index 20bfeab..5b9def0 100644 --- a/src/lib/extensions/discord.js/BushStoreChannel.ts +++ b/src/lib/extensions/discord.js/BushStoreChannel.ts @@ -1,12 +1,8 @@ -import { Collection, Snowflake, StoreChannel } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushCategoryChannel } from './BushCategoryChannel'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; +import { type BushCategoryChannel, type BushClient, type BushGuild, type BushGuildMember } from '@lib'; +import { StoreChannel, type Collection, type Snowflake } from 'discord.js'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushStoreChannel extends StoreChannel { - public declare readonly client: BushClient; public declare guild: BushGuild; public declare readonly members: Collection; public declare readonly parent: BushCategoryChannel | null; diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts index 1d4d7fe..5001ddb 100644 --- a/src/lib/extensions/discord.js/BushTextChannel.ts +++ b/src/lib/extensions/discord.js/BushTextChannel.ts @@ -1,12 +1,8 @@ -import { AllowedThreadTypeForTextChannel, TextChannel } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushMessageManager } from './BushMessageManager'; -import { BushThreadManager } from './BushThreadManager'; +import { type BushGuild, type BushMessageManager, type BushThreadManager } from '@lib'; +import { TextChannel, type AllowedThreadTypeForTextChannel } from 'discord.js'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushTextChannel extends TextChannel { - public declare readonly client: BushClient; public declare guild: BushGuild; public declare messages: BushMessageManager; public declare threads: BushThreadManager; diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts index b78aff7..9319651 100644 --- a/src/lib/extensions/discord.js/BushThreadChannel.ts +++ b/src/lib/extensions/discord.js/BushThreadChannel.ts @@ -1,12 +1,14 @@ -import { Collection, Snowflake, ThreadChannel } from 'discord.js'; -import { RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushMessageManager } from './BushMessageManager'; -import { BushNewsChannel } from './BushNewsChannel'; -import { BushTextChannel } from './BushTextChannel'; -import { BushThreadMemberManager } from './BushThreadMemberManager'; +import { + type BushClient, + type BushGuild, + type BushGuildMember, + type BushMessageManager, + type BushNewsChannel, + type BushTextChannel, + type BushThreadMemberManager +} from '@lib'; +import { ThreadChannel, type Collection, type Snowflake } from 'discord.js'; +import { type RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; export class BushThreadChannel extends ThreadChannel { public declare guild: BushGuild; diff --git a/src/lib/extensions/discord.js/BushThreadManager.d.ts b/src/lib/extensions/discord.js/BushThreadManager.d.ts index 027d532..86e85a9 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.d.ts @@ -1,25 +1,27 @@ import { - BaseFetchOptions, - CachedManager, - FetchArchivedThreadOptions, - FetchThreadsOptions, - Snowflake, - ThreadChannelResolvable, - ThreadCreateOptions + type BushThreadChannel +} from '@lib'; +import { + CachedManager, + FetchedThreads, + NewsChannel, + TextChannel, + ThreadChannel, + type BaseFetchOptions, + type FetchArchivedThreadOptions, + type FetchThreadsOptions, + type Snowflake, + type ThreadChannelResolvable, + type ThreadCreateOptions } from 'discord.js'; -import { RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushFetchedThreads, BushThreadChannelResolvable } from '../discord-akairo/BushClient'; -import { BushNewsChannel } from './BushNewsChannel'; -import { BushTextChannel } from './BushTextChannel'; -import { BushThreadChannel } from './BushThreadChannel'; +import { type RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; export class BushThreadManager extends CachedManager { - public constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable); - public declare readonly client: BushClient; - public channel: BushTextChannel | BushNewsChannel; - public create(options: ThreadCreateOptions): Promise; - public fetch(options: BushThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise; - public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise; - public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise; - public fetchActive(cache?: boolean): Promise; -} + public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable); + public channel: TextChannel | NewsChannel; + public create(options: ThreadCreateOptions): Promise; + public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise; + public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise; + public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise; + public fetchActive(cache?: boolean): Promise; +} \ No newline at end of file diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts index 10c7e84..70bd26f 100644 --- a/src/lib/extensions/discord.js/BushThreadMember.ts +++ b/src/lib/extensions/discord.js/BushThreadMember.ts @@ -1,8 +1,6 @@ +import { type BushGuildMember, type BushThreadChannel, type BushUser } from '@lib'; import { ThreadMember } from 'discord.js'; -import { RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; -import { BushGuildMember } from './BushGuildMember'; -import { BushThreadChannel } from './BushThreadChannel'; -import { BushUser } from './BushUser'; +import { type RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; export class BushThreadMember extends ThreadMember { public declare readonly guildMember: BushGuildMember | null; diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts index cbc28de..34346aa 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts @@ -1,14 +1,20 @@ -import { CachedManager, Collection, Snowflake, ThreadChannel, ThreadMember, UserResolvable } from 'discord.js'; -import { RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushThreadMemberResolvable } from '../discord-akairo/BushClient'; -import { BushThreadChannel } from './BushThreadChannel'; -import { BushThreadMember } from './BushThreadMember'; +import { type BushClient, type BushThreadChannel, type BushThreadMember, type BushThreadMemberResolvable } from '@lib'; +import { + CachedManager, + type BaseFetchOptions, + type Collection, + type Snowflake, + type UserResolvable +} from 'discord.js'; +import { type RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; export class BushThreadMemberManager extends CachedManager { public constructor(thread: BushThreadChannel, iterable?: Iterable); public declare readonly client: BushClient; - public thread: ThreadChannel; + public thread: BushThreadChannel; public add(member: UserResolvable | '@me', reason?: string): Promise; - public fetch(cache?: boolean): Promise>; + public fetch(member?: UserResolvable, options?: BaseFetchOptions): Promise; + /** @deprecated Use `fetch(member, options)` instead. */ + public fetch(cache?: boolean): Promise>; public remove(id: Snowflake | '@me', reason?: string): Promise; } diff --git a/src/lib/extensions/discord.js/BushUser.ts b/src/lib/extensions/discord.js/BushUser.ts index 15a0d03..6cfe6e9 100644 --- a/src/lib/extensions/discord.js/BushUser.ts +++ b/src/lib/extensions/discord.js/BushUser.ts @@ -1,7 +1,6 @@ -import { Partialize, User } from 'discord.js'; -import { RawUserData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushDMChannel } from './BushDMChannel'; +import { type BushClient, type BushDMChannel } from '@lib'; +import { User, type Partialize } from 'discord.js'; +import { type RawUserData } from 'discord.js/typings/rawDataTypes'; export type PartialBushUser = Partialize; diff --git a/src/lib/extensions/discord.js/BushUserManager.d.ts b/src/lib/extensions/discord.js/BushUserManager.d.ts index 49fc680..f3fffac 100644 --- a/src/lib/extensions/discord.js/BushUserManager.d.ts +++ b/src/lib/extensions/discord.js/BushUserManager.d.ts @@ -1,8 +1,6 @@ -import { Snowflake } from 'discord-api-types'; -import { BaseFetchOptions, CachedManager } from 'discord.js'; -import { RawUserData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; -import { BushUser } from './BushUser'; +import { type BushClient, type BushUser, type BushUserResolvable } from '@lib'; +import { CachedManager, type BaseFetchOptions, type Snowflake } from 'discord.js'; +import { type RawUserData } from 'discord.js/typings/rawDataTypes'; export class BushUserManager extends CachedManager { public constructor(client: BushClient, iterable?: Iterable); diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts index ab0da15..15a402f 100644 --- a/src/lib/extensions/discord.js/BushVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts @@ -1,8 +1,6 @@ -import { Collection, Snowflake, VoiceChannel } from 'discord.js'; -import { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; +import { type BushClient, type BushGuild, type BushGuildMember } from '@lib'; +import { VoiceChannel, type Collection, type Snowflake } from 'discord.js'; +import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushVoiceChannel extends VoiceChannel { public declare readonly client: BushClient; diff --git a/src/lib/extensions/discord.js/BushVoiceState.ts b/src/lib/extensions/discord.js/BushVoiceState.ts index d9570ad..7889f3b 100644 --- a/src/lib/extensions/discord.js/BushVoiceState.ts +++ b/src/lib/extensions/discord.js/BushVoiceState.ts @@ -1,11 +1,9 @@ +import { type BushGuild, type BushGuildMember, type BushStageChannel, type BushVoiceChannel } from '@lib'; import { VoiceState } from 'discord.js'; -import { RawVoiceStateData } from 'discord.js/typings/rawDataTypes'; -import { BushGuild } from './BushGuild'; -import { BushGuildMember } from './BushGuildMember'; -import { BushStageChannel } from './BushStageChannel'; -import { BushVoiceChannel } from './BushVoiceChannel'; +import { type RawVoiceStateData } from 'discord.js/typings/rawDataTypes'; export class BushVoiceState extends VoiceState { + // public declare readonly client: BushClient; public declare readonly channel: BushVoiceChannel | BushStageChannel | null; public declare guild: BushGuild; public declare readonly member: BushGuildMember | null; diff --git a/src/lib/index.ts b/src/lib/index.ts index ec4dcb2..da02888 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -3,6 +3,8 @@ export * from './common/ButtonPaginator'; export * from './common/DeleteButton'; export * from './common/Format'; export * from './common/Moderation'; +export type { BushInspectOptions } from './common/typings/BushInspectOptions'; +export type { CodeBlockLang } from './common/typings/CodeBlockLang'; export * from './common/util/Arg'; export * from './extensions/discord-akairo/BushArgumentTypeCaster'; export * from './extensions/discord-akairo/BushClient'; diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index 0ad6cd8..83ada29 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -1,6 +1,6 @@ -import { Snowflake } from 'discord.js'; +import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; -import { DataTypes, Sequelize } from 'sequelize'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; export enum ActivePunishmentType { @@ -30,34 +30,45 @@ export interface ActivePunishmentModelCreationAttributes { modlog: string; } -// declaration merging so that the fields don't override Sequelize's getters -export interface ActivePunishment { - /** The ID of this punishment (no real use just for a primary key) */ - id: string; +export class ActivePunishment + extends BaseModel + implements ActivePunishmentModel +{ + /** + * The ID of this punishment (no real use just for a primary key) + */ + public declare id: string; - /** The type of punishment. */ - type: ActivePunishmentType; + /** + * The type of punishment. + */ + public declare type: ActivePunishmentType; - /** The user who is punished. */ - user: Snowflake; + /** + * The user who is punished. + */ + public declare user: Snowflake; - /** The guild they are punished in. */ - guild: Snowflake; + /** + * The guild they are punished in. + */ + public declare guild: Snowflake; - /** Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. */ - extraInfo: Snowflake; + /** + * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. + */ + public declare extraInfo: Snowflake; - /** The date when this punishment expires (optional). */ - expires: Date | null; + /** + * The date when this punishment expires (optional). + */ + public declare expires: Date | null; - /** The reference to the modlog entry. */ - modlog: string; -} + /** + * The reference to the modlog entry. + */ + public declare modlog: string; -export class ActivePunishment - extends BaseModel - implements ActivePunishmentModel -{ public static initModel(sequelize: Sequelize): void { ActivePunishment.init( { diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts index d9377d1..8fba5e5 100644 --- a/src/lib/models/BaseModel.ts +++ b/src/lib/models/BaseModel.ts @@ -1,13 +1,13 @@ import { Model } from 'sequelize'; -// declaration merging so that the fields don't override Sequelize's getters -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export interface BaseModel { - /** The date when the row was created. */ - readonly createdAt: Date; +export abstract class BaseModel extends Model { + /** + * The date when the row was created. + */ + public declare readonly createdAt: Date; - /** The date when the row was last updated. */ - readonly updatedAt: Date; + /** + * The date when the row was last updated. + */ + public declare readonly updatedAt: Date; } - -export abstract class BaseModel extends Model {} diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index c5c680d..6b6ebae 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -1,5 +1,5 @@ -import { Snowflake } from 'discord.js'; -import { DataTypes, Sequelize } from 'sequelize'; +import { type Snowflake } from 'discord.js'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; import { jsonArray } from './__helpers'; @@ -21,28 +21,37 @@ export interface GlobalModelCreationAttributes { blacklistedChannels?: Snowflake[]; } -// declaration merging so that the fields don't override Sequelize's getters -export interface Global { - /** The bot's environment. */ - environment: 'production' | 'development' | 'beta'; +export class Global extends BaseModel implements GlobalModel { + /** + * The bot's environment. + */ + public declare environment: 'production' | 'development' | 'beta'; - /** Trusted users. */ - superUsers: Snowflake[]; + /** + * Trusted users. + */ + public declare superUsers: Snowflake[]; - /** Globally disabled commands. */ - disabledCommands: string[]; + /** + * Globally disabled commands. + */ + public declare disabledCommands: string[]; - /** Globally blacklisted users. */ - blacklistedUsers: Snowflake[]; + /** + * Globally blacklisted users. + */ + public declare blacklistedUsers: Snowflake[]; - /** Guilds blacklisted from using the bot. */ - blacklistedGuilds: Snowflake[]; + /** + * Guilds blacklisted from using the bot. + */ + public declare blacklistedGuilds: Snowflake[]; - /** Channels where the bot is prevented from running. */ - blacklistedChannels: Snowflake[]; -} + /** + * Channels where the bot is prevented from running commands in. + */ + public declare blacklistedChannels: Snowflake[]; -export class Global extends BaseModel implements GlobalModel { public static initModel(sequelize: Sequelize): void { Global.init( { diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 1fadde9..583cbd7 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -1,7 +1,7 @@ -import { Snowflake } from 'discord.js'; -import { DataTypes, Sequelize } from 'sequelize'; -import { BadWords } from '../common/AutoMod'; -import { BushClient } from '../extensions/discord-akairo/BushClient'; +import { type Snowflake } from 'discord.js'; +import { DataTypes, type Sequelize } from 'sequelize'; +import { type BadWords } from '../common/AutoMod'; +import { type BushClient } from '../extensions/discord-akairo/BushClient'; import { BaseModel } from './BaseModel'; import { jsonArray, jsonObject } from './__helpers'; @@ -47,64 +47,97 @@ export interface GuildModelCreationAttributes { levelUpChannel?: Snowflake; } -// declaration merging so that the fields don't override Sequelize's getters -export interface Guild { - /** The ID of the guild */ - id: Snowflake; +export class Guild extends BaseModel implements GuildModel { + /** + * The ID of the guild + */ + public declare id: Snowflake; - /** The bot's prefix for the guild */ - prefix: string; + /** + * The bot's prefix for the guild + */ + public declare prefix: string; - /** Channels that will have their messages automatically published */ - autoPublishChannels: Snowflake[]; + /** + * Channels that will have their messages automatically published + */ + public declare autoPublishChannels: Snowflake[]; - /** Channels where the bot won't respond in. */ - blacklistedChannels: Snowflake[]; + /** + * Channels where the bot won't respond in. + */ + public declare blacklistedChannels: Snowflake[]; - /** Users that the bot ignores in this guild */ - blacklistedUsers: Snowflake[]; + /** + * Users that the bot ignores in this guild + */ + public declare blacklistedUsers: Snowflake[]; - /** The channels where the welcome messages are sent */ - welcomeChannel: Snowflake; + /** + * The channels where the welcome messages are sent + */ + public declare welcomeChannel: Snowflake; - /** The role given out when muting someone */ - muteRole: Snowflake; + /** + * The role given out when muting someone + */ + public declare muteRole: Snowflake; - /** The message that gets sent after someone gets a punishment dm */ - punishmentEnding: string; + /** + * The message that gets sent after someone gets a punishment dm + */ + public declare punishmentEnding: string; - /** Guild specific disabled commands */ - disabledCommands: string[]; + /** + * Guild specific disabled commands + */ + public declare disabledCommands: string[]; - /** Channels that should get locked down when the lockdown command gets used. */ - lockdownChannels: Snowflake[]; + /** + * Channels that should get locked down when the lockdown command gets used. + */ + public declare lockdownChannels: Snowflake[]; - /** Custom automod phases */ - autoModPhases: BadWords; + /** + * Custom automod phases + */ + public declare autoModPhases: BadWords; - /** The features enabled in a guild */ - enabledFeatures: GuildFeatures[]; + /** + * The features enabled in a guild + */ + public declare enabledFeatures: GuildFeatures[]; - /** The roles to assign to a user if they are not assigned sticky roles */ - joinRoles: Snowflake[]; + /** + * The roles to assign to a user if they are not assigned sticky roles + */ + public declare joinRoles: Snowflake[]; - /** The channels where logging messages will be sent. */ - logChannels: LogChannelDB; + /** + * The channels where logging messages will be sent. + */ + public declare logChannels: LogChannelDB; - /** These users will be able to use commands in channels blacklisted */ - bypassChannelBlacklist: Snowflake[]; + /** + * These users will be able to use commands in channels blacklisted + */ + public declare bypassChannelBlacklist: Snowflake[]; - /** Channels where users will not earn xp for leveling. */ - noXpChannels: Snowflake[]; + /** + * Channels where users will not earn xp for leveling. + */ + public declare noXpChannels: Snowflake[]; - /** What roles get given to users when they reach certain levels. */ - levelRoles: { [level: number]: Snowflake }; + /** + * What roles get given to users when they reach certain levels. + */ + public declare levelRoles: { [level: number]: Snowflake }; - /** The channel to send level up messages in instead of last channel. */ - levelUpChannel: Snowflake; -} + /** + * The channel to send level up messages in instead of last channel. + */ + public declare levelUpChannel: Snowflake; -export class Guild extends BaseModel implements GuildModel { public static initModel(sequelize: Sequelize, client: BushClient): void { Guild.init( { diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index 7f418fd..6499bff 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -1,5 +1,5 @@ -import { Snowflake } from 'discord.js'; -import { DataTypes, Sequelize } from 'sequelize'; +import { type Snowflake } from 'discord.js'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; export interface LevelModel { @@ -14,20 +14,25 @@ export interface LevelModelCreationAttributes { xp?: number; } -// declaration merging so that the fields don't override Sequelize's getters -export interface Level { - /** The user's id. */ - user: Snowflake; +export class Level extends BaseModel implements LevelModel { + /** + * The user's id. + */ + public declare user: Snowflake; - /** The guild where the user is gaining xp. */ - guild: Snowflake; + /** + * The guild where the user is gaining xp. + */ + public declare guild: Snowflake; - /**The user's xp.*/ - xp: number; -} + /** + * The user's xp. + */ + public declare xp: number; -export class Level extends BaseModel implements LevelModel { - /** The user's level. */ + /** + * The user's level. + */ public get level(): number { return Level.convertXpToLevel(this.xp); } @@ -44,19 +49,11 @@ export class Level extends BaseModel i } public static convertXpToLevel(xp: number): number { - let i = 1; - let lvl: number; - // eslint-disable-next-line no-constant-condition - while (true) { - const neededXp = Level.convertLevelToXp(i); - if (neededXp > xp) { - lvl = i; - break; - } else { - i++; - } + let i = 0; + while (Level.convertLevelToXp(i + 1) < xp) { + i++; } - return lvl - 1; // I have to do this don't question it ok + return i; } public static convertLevelToXp(level: number): number { diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 0151cf6..b2351b9 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -1,6 +1,6 @@ -import { Snowflake } from 'discord.js'; +import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; -import { DataTypes, Sequelize } from 'sequelize'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; import { jsonBoolean } from './__helpers'; @@ -47,45 +47,62 @@ export interface ModLogModelCreationAttributes { hidden?: boolean; } -// declaration merging so that the fields don't override Sequelize's getters -export interface ModLog { - /** The primary key of the modlog entry. */ - id: string; +export class ModLog extends BaseModel implements ModLogModel { + /** + * The primary key of the modlog entry. + */ + public declare id: string; + + /** + * The type of punishment. + */ + public declare type: ModLogType; - /** The type of punishment. */ - type: ModLogType; + /** + * The user being punished. + */ + public declare user: Snowflake; - /** The user being punished. */ - user: Snowflake; + /** + * The user carrying out the punishment. + */ + public declare moderator: Snowflake; - /** The user carrying out the punishment. */ - moderator: Snowflake; - - /** The reason the user is getting punished. */ - reason: string | null; + /** + * The reason the user is getting punished. + */ + public declare reason: string | null; - /** The amount of time the user is getting punished for. */ - duration: number | null; + /** + * The amount of time the user is getting punished for. + */ + public declare duration: number | null; - /** The guild the user is getting punished in. */ - guild: Snowflake; + /** + * The guild the user is getting punished in. + */ + public declare guild: Snowflake; - /** Evidence of what the user is getting punished for. */ - evidence: string; + /** + * Evidence of what the user is getting punished for. + */ + public declare evidence: string; - /** Not an actual modlog just used so a punishment entry can be made. */ - pseudo: boolean; + /** + * Not an actual modlog just used so a punishment entry can be made. + */ + public declare pseudo: boolean; - /** Hides from the modlog command unless show hidden is specified. */ - hidden: boolean; -} + /** + * Hides from the modlog command unless show hidden is specified. + */ + public declare hidden: boolean; -export class ModLog extends BaseModel implements ModLogModel { public static initModel(sequelize: Sequelize): void { ModLog.init( { id: { type: DataTypes.STRING, primaryKey: true, allowNull: false, defaultValue: nanoid }, - type: { type: DataTypes.STRING, allowNull: false }, //# This is not an enum because of a sequelize issue: https://github.com/sequelize/sequelize/issues/2554 + type: { type: DataTypes.STRING, allowNull: false }, //? This is not an enum because of a sequelize issue: https://github.com/sequelize/sequelize/issues/2554 user: { type: DataTypes.STRING, allowNull: false }, moderator: { type: DataTypes.STRING, allowNull: false }, duration: { type: DataTypes.STRING, allowNull: true }, diff --git a/src/lib/models/Stat.ts b/src/lib/models/Stat.ts index 89fc00f..a6e8f19 100644 --- a/src/lib/models/Stat.ts +++ b/src/lib/models/Stat.ts @@ -1,4 +1,4 @@ -import { DataTypes, Sequelize } from 'sequelize'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; import { jsonBigint } from './__helpers'; @@ -14,16 +14,17 @@ export interface StatModelCreationAttributes { commandsUsed?: bigint; } -// declaration merging so that the fields don't override Sequelize's getters -export interface Stat { - /** The bot's environment. */ - environment: Environment; +export class Stat extends BaseModel implements StatModel { + /** + * The bot's environment. + */ + public declare environment: Environment; - /** The number of commands used */ - commandsUsed: bigint; -} + /** + * The number of commands used + */ + public declare commandsUsed: bigint; -export class Stat extends BaseModel implements StatModel { public static initModel(sequelize: Sequelize): void { Stat.init( { diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index 77e1889..657bac6 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -1,5 +1,5 @@ -import { Snowflake } from 'discord.js'; -import { DataTypes, Sequelize } from 'sequelize'; +import { type Snowflake } from 'discord.js'; +import { DataTypes, type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; import { jsonArray } from './__helpers'; @@ -16,22 +16,27 @@ export interface StickyRoleModelCreationAttributes { nickname?: string; } -// declaration merging so that the fields don't override Sequelize's getters -export interface StickyRole { - /** The id of the user the roles belongs to. */ - user: Snowflake; +export class StickyRole extends BaseModel implements StickyRoleModel { + /** + * The id of the user the roles belongs to. + */ + public declare user: Snowflake; - /** The guild where this should happen. */ - guild: Snowflake; + /** + * The guild where this should happen. + */ + public declare guild: Snowflake; - /** The roles that the user should have returned */ - roles: Snowflake[]; + /** + * The roles that the user should have returned + */ + public declare roles: Snowflake[]; - /** The user's previous nickname */ - nickname: string; -} + /** + * The user's previous nickname + */ + public declare nickname: string; -export class StickyRole extends BaseModel implements StickyRoleModel { public static initModel(sequelize: Sequelize): void { StickyRole.init( { diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts index dafbd84..3a958b9 100644 --- a/src/lib/models/__helpers.ts +++ b/src/lib/models/__helpers.ts @@ -1,4 +1,4 @@ -import { DataTypes, Model } from 'sequelize'; +import { DataTypes, type Model } from 'sequelize'; export function jsonParseGet(this: Model, key: string): any { return JSON.parse(this.getDataValue(key)); diff --git a/src/lib/utils/AllowedMentions.ts b/src/lib/utils/AllowedMentions.ts index 9b02c31..b4b188d 100644 --- a/src/lib/utils/AllowedMentions.ts +++ b/src/lib/utils/AllowedMentions.ts @@ -1,4 +1,4 @@ -import { MessageMentionOptions, MessageMentionTypes } from 'discord.js'; +import { type MessageMentionOptions, type MessageMentionTypes } from 'discord.js'; export class AllowedMentions { public everyone: boolean; diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index cdf328b..a330224 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -1,4 +1,4 @@ -import { Collection, Snowflake } from 'discord.js'; +import { Collection, type Snowflake } from 'discord.js'; import { Guild } from '../models/Guild'; export class BushCache { diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index a4b3108..0377026 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -1,4 +1,4 @@ -import { Constants, ConstantsColors } from 'discord.js'; +import { Constants, type ConstantsColors } from 'discord.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; export class BushConstants { diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 2aaba5b..4b89622 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,7 +1,7 @@ import chalk from 'chalk'; -import { Message, MessageEmbed, Util } from 'discord.js'; +import { MessageEmbed, Util, type Message } from 'discord.js'; import { inspect } from 'util'; -import { BushSendMessageType } from '../extensions/discord-akairo/BushClient'; +import { type BushSendMessageType } from '../extensions/discord-akairo/BushClient'; export class BushLogger { static #parseFormatting( diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts index 81e3a85..0d44924 100644 --- a/src/lib/utils/Config.ts +++ b/src/lib/utils/Config.ts @@ -1,4 +1,4 @@ -import { Snowflake } from 'discord.js'; +import { type Snowflake } from 'discord.js'; export class Config { public credentials: Credentials; -- cgit