diff options
Diffstat (limited to 'src/lib')
25 files changed, 323 insertions, 336 deletions
diff --git a/src/lib/badwords.ts b/src/lib/badwords.ts index 20ca29d..cab7cec 100644 --- a/src/lib/badwords.ts +++ b/src/lib/badwords.ts @@ -359,7 +359,6 @@ export default { regex: false, }, - /* -------------------------------------------------------------------------- */ /* Misc Scams */ /* -------------------------------------------------------------------------- */ diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 6a2dba2..b8ae249 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -1,11 +1,11 @@ import { DeleteButton, type BushMessage, type BushSlashMessage } from '#lib'; import { - Constants, - MessageActionRow, - MessageButton, - MessageEmbed, - type MessageComponentInteraction, - type MessageEmbedOptions + Constants, + MessageActionRow, + MessageButton, + MessageEmbed, + type MessageComponentInteraction, + type MessageEmbedOptions } from 'discord.js'; export class ButtonPaginator { @@ -75,7 +75,7 @@ export class ButtonPaginator { })) as BushMessage; const collector = this.sentMessage.createMessageComponentCollector({ - filter: (i) => i.customId.startsWith('paginate_') && i.message.id === this.sentMessage!.id, + filter: (i) => i.customId.startsWith('paginate_') && i.message?.id === this.sentMessage!.id, time: 300000 }); @@ -128,11 +128,13 @@ export class ButtonPaginator { } protected async edit(interaction: MessageComponentInteraction) { - return interaction?.update({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow()] - }).catch(() => null); + 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 4792cf7..38ce6df 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -25,7 +25,7 @@ export class DeleteButton { const msg = (await this.message.util.reply(this.messageOptions)) as BushMessage; const collector = msg.createMessageComponentCollector({ - filter: (interaction) => interaction.customId == 'paginate__stop' && interaction.message.id == msg.id, + filter: (interaction) => interaction.customId == 'paginate__stop' && interaction.message?.id == msg.id, time: 300000 }); diff --git a/src/lib/common/Moderation.ts b/src/lib/common/Moderation.ts index 13ebf69..a7a037f 100644 --- a/src/lib/common/Moderation.ts +++ b/src/lib/common/Moderation.ts @@ -1,12 +1,12 @@ import { - ActivePunishment, - ActivePunishmentType, - Guild, - ModLog, - ModLogType, - type BushGuildMember, - type BushGuildMemberResolvable, - type BushGuildResolvable + ActivePunishment, + ActivePunishmentType, + Guild, + ModLog, + ModLogType, + type BushGuildMember, + type BushGuildMemberResolvable, + type BushGuildResolvable } from '#lib'; import { type Snowflake } from 'discord.js'; diff --git a/src/lib/common/typings/BushInspectOptions.d.ts b/src/lib/common/typings/BushInspectOptions.d.ts index e51e758..38c70b1 100644 --- a/src/lib/common/typings/BushInspectOptions.d.ts +++ b/src/lib/common/typings/BushInspectOptions.d.ts @@ -42,7 +42,7 @@ export interface BushInspectOptions extends InspectOptions { * **Default**: `false`. */ showProxy?: boolean | undefined; - + /** * Specifies the maximum number of `Array`, [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) elements to include when formatting. Set to `null` or `Infinity` to @@ -88,7 +88,7 @@ export interface BushInspectOptions extends InspectOptions { * **Default**: `false`. */ sorted?: boolean | ((a: string, b: string) => number) | undefined; - + /** * If set to `true`, getters are inspected. If set to `'get'`, only getters without a * corresponding setter are inspected. If set to `'set'`, only getters with a diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 93ed9d7..59aea26 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -10,6 +10,7 @@ import type { BushUserManager, Config } from '#lib'; +import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { @@ -18,7 +19,9 @@ import { Structures, version as discordJsVersion, type Awaitable, - type Collection, type DMChannel, type InteractionReplyOptions, + type Collection, + type DMChannel, + type InteractionReplyOptions, type Message, type MessageEditOptions, type MessageOptions, @@ -28,8 +31,6 @@ import { type Snowflake, type WebhookEditMessageOptions } from 'discord.js'; -//@ts-ignore: no typings -import eventsIntercept from 'events-intercept'; import path from 'path'; import readline from 'readline'; import type { Sequelize as SequelizeType } from 'sequelize'; @@ -92,7 +93,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 = Message| BushMessage | Snowflake; +export type BushMessageResolvable = Message | BushMessage | Snowflake; export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji; export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; @@ -157,6 +158,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re makeCache: Options.cacheWithLimits({}), failIfNotExists: false }); + patch(this); this.token = config.token as If<Ready, string, string | null>; this.config = config; @@ -344,8 +346,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re * Starts the bot */ public async start() { - eventsIntercept.patch(this); - //@ts-expect-error: no typings this.intercept('ready', async (arg, done) => { await this.guilds.fetch(); const promises = this.guilds.cache.map((guild) => { @@ -386,23 +386,21 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re const userID = this.users.resolveId(user)!; return !!client.cache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID); } - - } -export interface BushClient { +export interface BushClient extends PatchedElements { on<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - on<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + on<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; once<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - once<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + once<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean; - emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean + emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean; off<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - off<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this + off<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this; removeAllListeners<K extends keyof BushClientEvents>(event?: K): this; - removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this + removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this; } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index f21d104..8f1e67a 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -16,6 +16,7 @@ import { type Pronoun, type PronounCode } from '#lib'; +import { humanizeDuration } from '@notenoughupdates/humanize-duration'; import { exec } from 'child_process'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; import { APIMessage } from 'discord-api-types'; @@ -40,7 +41,6 @@ import moment from 'moment'; import { inspect, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError.js'; import { Format } from '../../common/Format.js'; -const { default: humanizeDuration } = await import ('humanize-duration') export class BushClientUtil extends ClientUtil { /** @@ -255,11 +255,11 @@ export class BushClientUtil extends ClientUtil { * @param options - The options you would like to use to inspect the object */ public inspect(object: any, options?: BushInspectOptions): string { - const optionsWithDefaults = this.getDefaultInspectOptions(options) + const optionsWithDefaults = this.getDefaultInspectOptions(options); return inspect(object, optionsWithDefaults); } - private getDefaultInspectOptions(options?:BushInspectOptions): BushInspectOptions { + private getDefaultInspectOptions(options?: BushInspectOptions): BushInspectOptions { const { showHidden = false, depth = 2, @@ -274,18 +274,18 @@ export class BushClientUtil extends ClientUtil { getters = true } = options ?? {}; return { - showHidden, - depth, - colors, - customInspect, - showProxy, - maxArrayLength, - maxStringLength, - breakLength, - compact, - sorted, + showHidden, + depth, + colors, + customInspect, + showProxy, + maxArrayLength, + maxStringLength, + breakLength, + compact, + sorted, getters - } + }; } #mapCredential(old: string): string { @@ -331,9 +331,7 @@ export class BushClientUtil extends ClientUtil { length = 1024 ) { input = - !inspectOptions?.inspectStrings && typeof input === 'string' - ? input - : this.inspect(input, inspectOptions ?? undefined); + !inspectOptions?.inspectStrings && typeof input === 'string' ? input : this.inspect(input, inspectOptions ?? undefined); if (inspectOptions) inspectOptions.inspectStrings = undefined; input = this.discord.cleanCodeBlockContent(input); input = this.redact(input); @@ -449,8 +447,8 @@ export class BushClientUtil extends ClientUtil { } public humanizeDuration(duration: number, largest?: number): string { - if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest }); - else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 }); + if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest })!; + else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 })!; } public timestampDuration(duration: number): string { diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 03f6606..11f5ee3 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,10 +1,16 @@ 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 { + Command, + type ArgumentOptions, + type ArgumentPromptOptions, + type ArgumentTypeCaster, + type CommandOptions +} from 'discord-akairo'; import { BaseArgumentType } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; import { type PermissionResolvable, type Snowflake } from 'discord.js'; -export type BaseBushArgumentType = - | BaseArgumentType +export type BaseBushArgumentType = + | BaseArgumentType | 'duration' | 'contentWithDuration' | 'permission' diff --git a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts index 652a50f..c3c279e 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts @@ -1,11 +1,4 @@ -import type { - BushCategoryChannel, - BushClient, - BushGuild, - BushGuildMember, - BushMessageManager, - BushThreadManager -} from '#lib'; +import type { BushCategoryChannel, BushClient, BushGuild, BushGuildMember, BushMessageManager, BushThreadManager } from '#lib'; import { BaseGuildTextChannel, type AllowedThreadTypeForNewsChannel, diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 5849749..ff920ce 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -191,7 +191,11 @@ export class BushGuild extends Guild { const userObject = client.users.cache.get(user.id); const dmSuccess = await userObject - ?.send(`You have been unbanned from **${util.discord.escapeMarkdown(this.toString())}** for **${options.reason ?? 'No reason provided'}**.`) + ?.send( + `You have been unbanned from **${util.discord.escapeMarkdown(this.toString())}** for **${ + options.reason ?? 'No reason provided' + }**.` + ) .catch(() => false); dmSuccessEvent = !!dmSuccess; diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.d.ts index 5bb8822..4dd0750 100644 --- a/src/lib/extensions/discord.js/BushGuildManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildManager.d.ts @@ -3,7 +3,8 @@ import { CachedManager, type Collection, type FetchGuildOptions, - type FetchGuildsOptions, type GuildCreateOptions, + type FetchGuildsOptions, + type GuildCreateOptions, type OAuth2Guild, type Snowflake } from 'discord.js'; diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts index 8b1248c..0866fce 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts @@ -1,11 +1,4 @@ -import type { - BushClient, - BushGuild, - BushGuildMember, - BushGuildMemberResolvable, - BushUser, - BushUserResolvable -} from '#lib'; +import type { BushClient, BushGuild, BushGuildMember, BushGuildMemberResolvable, BushUser, BushUserResolvable } from '#lib'; import { CachedManager, type AddGuildMemberOptions, diff --git a/src/lib/extensions/discord.js/BushMessageManager.d.ts b/src/lib/extensions/discord.js/BushMessageManager.d.ts index 9ded94c..f6bc8e7 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.d.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.d.ts @@ -1,26 +1,27 @@ import { BushMessageResolvable, type BushMessage, type BushTextBasedChannels } from '#lib'; import { - CachedManager, - type BaseFetchOptions, - type ChannelLogsQueryOptions, - type Collection, - type EmojiIdentifierResolvable, - type MessageEditOptions, - type MessagePayload, type Snowflake + CachedManager, + type BaseFetchOptions, + type ChannelLogsQueryOptions, + type Collection, + type EmojiIdentifierResolvable, + type MessageEditOptions, + type MessagePayload, + type Snowflake } from 'discord.js'; import type { RawMessageData } from 'discord.js/typings/rawDataTypes'; export class BushMessageManager extends CachedManager<Snowflake, BushMessage, BushMessageResolvable> { - public constructor(channel: BushTextBasedChannels, iterable?: Iterable<RawMessageData>); - public channel: BushTextBasedChannels; - public cache: Collection<Snowflake, BushMessage>; - public crosspost(message: BushMessageResolvable): Promise<BushMessage>; - public delete(message: BushMessageResolvable): Promise<void>; - public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise<BushMessage>; - public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<BushMessage>; - public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise<Collection<Snowflake, BushMessage>>; - public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, BushMessage>>; - public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise<void>; - public pin(message: BushMessageResolvable): Promise<void>; - public unpin(message: BushMessageResolvable): Promise<void>; + public constructor(channel: BushTextBasedChannels, iterable?: Iterable<RawMessageData>); + public channel: BushTextBasedChannels; + public cache: Collection<Snowflake, BushMessage>; + public crosspost(message: BushMessageResolvable): Promise<BushMessage>; + public delete(message: BushMessageResolvable): Promise<void>; + public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise<BushMessage>; + public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<BushMessage>; + public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise<Collection<Snowflake, BushMessage>>; + public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, BushMessage>>; + public react(message: BushMessageResolvable, emoji: EmojiIdentifierResolvable): Promise<void>; + public pin(message: BushMessageResolvable): Promise<void>; + public unpin(message: BushMessageResolvable): Promise<void>; } diff --git a/src/lib/extensions/discord.js/BushThreadManager.d.ts b/src/lib/extensions/discord.js/BushThreadManager.d.ts index 6822a80..c824ae7 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.d.ts @@ -1,27 +1,25 @@ -import type { - BushThreadChannel -} from '#lib'; +import type { BushThreadChannel } from '#lib'; import { - CachedManager, - FetchedThreads, - NewsChannel, - TextChannel, - ThreadChannel, - type BaseFetchOptions, - type FetchArchivedThreadOptions, - type FetchThreadsOptions, - type Snowflake, - type ThreadChannelResolvable, - type ThreadCreateOptions + CachedManager, + FetchedThreads, + NewsChannel, + TextChannel, + ThreadChannel, + type BaseFetchOptions, + type FetchArchivedThreadOptions, + type FetchThreadsOptions, + type Snowflake, + type ThreadChannelResolvable, + type ThreadCreateOptions } from 'discord.js'; import type { RawThreadChannelData } from 'discord.js/typings/rawDataTypes'; export class BushThreadManager<AllowedThreadType> extends CachedManager<Snowflake, BushThreadChannel, ThreadChannelResolvable> { - public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>); - public channel: TextChannel | NewsChannel; - public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>; - public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<ThreadChannel | null>; - public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>; - public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>; - public fetchActive(cache?: boolean): Promise<FetchedThreads>; -}
\ No newline at end of file + public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>); + public channel: TextChannel | NewsChannel; + public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>; + public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<ThreadChannel | null>; + public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>; + public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>; + public fetchActive(cache?: boolean): Promise<FetchedThreads>; +} diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts index 082d87c..7560c0e 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts @@ -1,11 +1,5 @@ import type { BushClient, BushThreadChannel, BushThreadMember, BushThreadMemberResolvable } from '#lib'; -import { - CachedManager, - type BaseFetchOptions, - type Collection, - type Snowflake, - type UserResolvable -} from 'discord.js'; +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<Snowflake, BushThreadMember, BushThreadMemberResolvable> { @@ -14,7 +8,7 @@ export class BushThreadMemberManager extends CachedManager<Snowflake, BushThread public thread: BushThreadChannel; public add(member: UserResolvable | '@me', reason?: string): Promise<Snowflake>; public fetch(member?: UserResolvable, options?: BaseFetchOptions): Promise<BushThreadMember>; - /** @deprecated Use `fetch(member, options)` instead. */ + /** @deprecated Use `fetch(member, options)` instead. */ public fetch(cache?: boolean): Promise<Collection<Snowflake, BushThreadMember>>; public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>; } diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index ec1b500..4512101 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export enum ActivePunishmentType { BAN = 'BAN', @@ -35,38 +35,38 @@ export class ActivePunishment extends BaseModel<ActivePunishmentModel, ActivePunishmentModelCreationAttributes> implements ActivePunishmentModel { - /** - * The ID of this punishment (no real use just for a primary key) + /** + * The ID of this punishment (no real use just for a primary key) */ public declare id: string; - /** + /** * The type of punishment. */ public declare type: ActivePunishmentType; - /** - * The user who is punished. + /** + * The user who is punished. */ public declare user: Snowflake; - /** - * The guild they are punished in. + /** + * 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. + /** + * 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). + /** + * The date when this punishment expires (optional). */ public declare expires: Date | null; - /** - * The reference to the modlog entry. + /** + * The reference to the modlog entry. */ public declare modlog: string; diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index b096c7f..e0cd7f9 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -3,7 +3,7 @@ import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonArray } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface GlobalModel { environment: 'production' | 'development' | 'beta'; @@ -24,32 +24,32 @@ export interface GlobalModelCreationAttributes { } export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes> implements GlobalModel { - /** - * The bot's environment. + /** + * The bot's environment. */ public declare environment: 'production' | 'development' | 'beta'; - /** - * Trusted users. + /** + * Trusted users. */ public declare superUsers: Snowflake[]; - /** - * Globally disabled commands. + /** + * Globally disabled commands. */ public declare disabledCommands: string[]; - /** - * Globally blacklisted users. + /** + * Globally blacklisted users. */ public declare blacklistedUsers: Snowflake[]; - /** - * Guilds blacklisted from using the bot. + /** + * Guilds blacklisted from using the bot. */ public declare blacklistedGuilds: Snowflake[]; - /** + /** * Channels where the bot is prevented from running commands in. */ public declare blacklistedChannels: Snowflake[]; diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 78be846..02f487b 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -5,7 +5,7 @@ import { type BushClient } from '../extensions/discord-akairo/BushClient.js'; import { BaseModel } from './BaseModel.js'; import { jsonArray, jsonObject } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface GuildModel { id: Snowflake; @@ -50,93 +50,93 @@ export interface GuildModelCreationAttributes { } export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel { - /** - * The ID of the guild + /** + * The ID of the guild */ public declare id: Snowflake; - /** - * The bot's prefix for the guild + /** + * The bot's prefix for the guild */ public declare prefix: string; - /** - * Channels that will have their messages automatically published + /** + * Channels that will have their messages automatically published */ public declare autoPublishChannels: Snowflake[]; - /** - * Channels where the bot won't respond in. + /** + * Channels where the bot won't respond in. */ public declare blacklistedChannels: Snowflake[]; - /** - * Users that the bot ignores in this guild + /** + * Users that the bot ignores in this guild */ public declare blacklistedUsers: Snowflake[]; - /** - * The channels where the welcome messages are sent + /** + * The channels where the welcome messages are sent */ public declare welcomeChannel: Snowflake; - /** - * The role given out when muting someone + /** + * The role given out when muting someone */ public declare muteRole: Snowflake; - /** - * The message that gets sent after someone gets a punishment dm + /** + * The message that gets sent after someone gets a punishment dm */ public declare punishmentEnding: string; - /** - * Guild specific disabled commands + /** + * Guild specific disabled commands */ public declare disabledCommands: string[]; - /** - * Channels that should get locked down when the lockdown command gets used. + /** + * Channels that should get locked down when the lockdown command gets used. */ public declare lockdownChannels: Snowflake[]; - /** - * Custom automod phases + /** + * Custom automod phases */ public declare autoModPhases: BadWords; - /** - * The features enabled in a guild + /** + * The features enabled in a guild */ public declare enabledFeatures: GuildFeatures[]; - /** - * The roles to assign to a user if they are not assigned sticky roles + /** + * 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. + /** + * The channels where logging messages will be sent. */ public declare logChannels: LogChannelDB; - /** - * These users will be able to use commands in channels blacklisted + /** + * These users will be able to use commands in channels blacklisted */ public declare bypassChannelBlacklist: Snowflake[]; - /** - * Channels where users will not earn xp for leveling. + /** + * Channels where users will not earn xp for leveling. */ public declare noXpChannels: Snowflake[]; - /** - * What roles get given to users when they reach certain levels. + /** + * 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. + /** + * The channel to send level up messages in instead of last channel. */ public declare levelUpChannel: Snowflake; diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index f1083fc..baf359b 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface LevelModel { user: Snowflake; @@ -17,13 +17,13 @@ export interface LevelModelCreationAttributes { } export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> implements LevelModel { - /** - * The user's id. + /** + * The user's id. */ public declare user: Snowflake; - /** - * The guild where the user is gaining xp. + /** + * The guild where the user is gaining xp. */ public declare guild: Snowflake; @@ -32,8 +32,8 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> i */ public declare xp: number; - /** - * The user's level. + /** + * The user's level. */ public get level(): number { return Level.convertXpToLevel(this.xp); diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index bb1be8c..7d656a4 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -3,7 +3,7 @@ import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBoolean } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export enum ModLogType { PERM_BAN = 'PERM_BAN', @@ -49,53 +49,53 @@ export interface ModLogModelCreationAttributes { } export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel { - /** - * The primary key of the modlog entry. + /** + * The primary key of the modlog entry. */ public declare id: string; - - /** - * The type of punishment. + + /** + * The type of punishment. */ public declare type: ModLogType; - /** - * The user being punished. + /** + * The user being punished. */ public declare user: Snowflake; - /** - * The user carrying out the punishment. + /** + * The user carrying out the punishment. */ public declare moderator: Snowflake; - /** - * The reason the user is getting punished. + /** + * The reason the user is getting punished. */ public declare reason: string | null; - /** - * The amount of time the user is getting punished for. + /** + * The amount of time the user is getting punished for. */ public declare duration: number | null; - /** - * The guild the user is getting punished in. + /** + * The guild the user is getting punished in. */ public declare guild: Snowflake; - /** - * Evidence of what the user is getting punished for. + /** + * 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. + /** + * 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. + /** + * Hides from the modlog command unless show hidden is specified. */ public declare hidden: boolean; diff --git a/src/lib/models/Stat.ts b/src/lib/models/Stat.ts index 31111df..4ecabb8 100644 --- a/src/lib/models/Stat.ts +++ b/src/lib/models/Stat.ts @@ -1,7 +1,7 @@ import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBigint } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; type Environment = 'production' | 'development' | 'beta'; @@ -16,14 +16,14 @@ export interface StatModelCreationAttributes { } export class Stat extends BaseModel<StatModel, StatModelCreationAttributes> implements StatModel { - /** - * The bot's environment. + /** + * The bot's environment. */ public declare environment: Environment; - /** - * The number of commands used - */ + /** + * The number of commands used + */ public declare commandsUsed: bigint; public static initModel(sequelize: Sequelize): void { diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index 63c9726..64f0b4d 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -2,7 +2,7 @@ import { type Snowflake } from 'discord.js'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonArray } from './__helpers.js'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export interface StickyRoleModel { user: Snowflake; @@ -18,23 +18,23 @@ export interface StickyRoleModelCreationAttributes { } export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel { - /** - * The id of the user the roles belongs to. + /** + * The id of the user the roles belongs to. */ public declare user: Snowflake; - /** - * The guild where this should happen. + /** + * The guild where this should happen. */ public declare guild: Snowflake; - /** - * The roles that the user should have returned + /** + * The roles that the user should have returned */ public declare roles: Snowflake[]; - /** - * The user's previous nickname + /** + * The user's previous nickname */ public declare nickname: string; diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts index 8c98d5b..75737c5 100644 --- a/src/lib/models/__helpers.ts +++ b/src/lib/models/__helpers.ts @@ -1,6 +1,6 @@ import { type Model } from 'sequelize'; -const { DataTypes } = (await import('sequelize')).default +const { DataTypes } = (await import('sequelize')).default; export function jsonParseGet(this: Model, key: string): any { return JSON.parse(this.getDataValue(key)); diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index 3808538..bfbd7e3 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -8,8 +8,8 @@ export class BushCache { export class GlobalCache { public superUsers: Snowflake[] = []; - public disabledCommands: string[] = [] + public disabledCommands: string[] = []; public blacklistedChannels: Snowflake[] = []; public blacklistedGuilds: Snowflake[] = []; - public blacklistedUsers: Snowflake[] = []; + public blacklistedUsers: Snowflake[] = []; } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index c48f7d7..52b0f40 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -3,8 +3,8 @@ import { Constants, type ConstantsColors } from 'discord.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; export class BushConstants { public static get emojis() { - return BushEmojis - }; + return BushEmojis; + } public static colors: bushColors = { default: '#1FD8F1', @@ -74,8 +74,8 @@ export class BushConstants { }; public static get pronounMapping() { - return PronounMap - }; + return PronounMap; + } /** A bunch of mappings */ public static mappings = { @@ -329,20 +329,20 @@ export class BushConstants { }; public static get ArgumentMatches() { - return ArgumentMatchesEnum - }; + return ArgumentMatchesEnum; + } public static get ArgumentTypes() { - return BushArgumentTypesEnum - }; + return BushArgumentTypesEnum; + } public static get BlockedReasons() { - return BushBlockedReasonsEnum - }; + return BushBlockedReasonsEnum; + } public static get CommandHandlerEvents() { - return BushCommandHandlerEventsEnum - }; + return BushCommandHandlerEventsEnum; + } public static moulberryBushRoleMap = [ { name: '*', id: '792453550768390194' }, @@ -417,72 +417,72 @@ export enum BushEmojis { } export enum ArgumentMatchesEnum { - PHRASE = "phrase", - FLAG = "flag", - OPTION = "option", - REST = "rest", - SEPARATE = "separate", - TEXT = "text", - CONTENT = "content", - REST_CONTENT = "restContent", - NONE = "none" + PHRASE = 'phrase', + FLAG = 'flag', + OPTION = 'option', + REST = 'rest', + SEPARATE = 'separate', + TEXT = 'text', + CONTENT = 'content', + REST_CONTENT = 'restContent', + NONE = 'none' } export enum BushArgumentTypesEnum { - STRING = "string", - LOWERCASE = "lowercase", - UPPERCASE = "uppercase", - CHAR_CODES = "charCodes", - NUMBER = "number", - INTEGER = "integer", - BIGINT = "bigint", - EMOJINT = "emojint", - URL = "url", - DATE = "date", - COLOR = "color", - USER = "user", - USERS = "users", - MEMBER = "member", - MEMBERS = "members", - RELEVANT = "relevant", - RELEVANTS = "relevants", - CHANNEL = "channel", - CHANNELS = "channels", - TEXT_CHANNEL = "textChannel", - TEXT_CHANNELS = "textChannels", - VOICE_CHANNEL = "voiceChannel", - VOICE_CHANNELS = "voiceChannels", - CATEGORY_CHANNEL = "categoryChannel", - CATEGORY_CHANNELS = "categoryChannels", - NEWS_CHANNEL = "newsChannel", - NEWS_CHANNELS = "newsChannels", - STORE_CHANNEL = "storeChannel", - STORE_CHANNELS = "storeChannels", - STAGE_CHANNEL = "stageChannel", - STAGE_CHANNELS = "stageChannels", - THREAD_CHANNEL = "threadChannel", - THREAD_CHANNELS = "threadChannels", - ROLE = "role", - ROLES = "roles", - EMOJI = "emoji", - EMOJIS = "emojis", - GUILD = "guild", - GUILDS = "guilds", - MESSAGE = "message", - GUILD_MESSAGE = "guildMessage", - RELEVANT_MESSAGE = "relevantMessage", - INVITE = "invite", - USER_MENTION = "userMention", - MEMBER_MENTION = "memberMention", - CHANNEL_MENTION = "channelMention", - ROLE_MENTION = "roleMention", - EMOJI_MENTION = "emojiMention", - COMMAND_ALIAS = "commandAlias", - COMMAND = "command", - INHIBITOR = "inhibitor", - LISTENER = "listener", - TASK = "task", - CONTEXT_MENU_COMMAND = "contextMenuCommand", + STRING = 'string', + LOWERCASE = 'lowercase', + UPPERCASE = 'uppercase', + CHAR_CODES = 'charCodes', + NUMBER = 'number', + INTEGER = 'integer', + BIGINT = 'bigint', + EMOJINT = 'emojint', + URL = 'url', + DATE = 'date', + COLOR = 'color', + USER = 'user', + USERS = 'users', + MEMBER = 'member', + MEMBERS = 'members', + RELEVANT = 'relevant', + RELEVANTS = 'relevants', + CHANNEL = 'channel', + CHANNELS = 'channels', + TEXT_CHANNEL = 'textChannel', + TEXT_CHANNELS = 'textChannels', + VOICE_CHANNEL = 'voiceChannel', + VOICE_CHANNELS = 'voiceChannels', + CATEGORY_CHANNEL = 'categoryChannel', + CATEGORY_CHANNELS = 'categoryChannels', + NEWS_CHANNEL = 'newsChannel', + NEWS_CHANNELS = 'newsChannels', + STORE_CHANNEL = 'storeChannel', + STORE_CHANNELS = 'storeChannels', + STAGE_CHANNEL = 'stageChannel', + STAGE_CHANNELS = 'stageChannels', + THREAD_CHANNEL = 'threadChannel', + THREAD_CHANNELS = 'threadChannels', + ROLE = 'role', + ROLES = 'roles', + EMOJI = 'emoji', + EMOJIS = 'emojis', + GUILD = 'guild', + GUILDS = 'guilds', + MESSAGE = 'message', + GUILD_MESSAGE = 'guildMessage', + RELEVANT_MESSAGE = 'relevantMessage', + INVITE = 'invite', + USER_MENTION = 'userMention', + MEMBER_MENTION = 'memberMention', + CHANNEL_MENTION = 'channelMention', + ROLE_MENTION = 'roleMention', + EMOJI_MENTION = 'emojiMention', + COMMAND_ALIAS = 'commandAlias', + COMMAND = 'command', + INHIBITOR = 'inhibitor', + LISTENER = 'listener', + TASK = 'task', + CONTEXT_MENU_COMMAND = 'contextMenuCommand', DURATION = 'duration', CONTENT_WITH_DURATION = 'contentWithDuration', PERMISSION = 'permission', @@ -490,7 +490,7 @@ export enum BushArgumentTypesEnum { DISCORD_EMOJI = 'discordEmoji', ROLE_WITH_DURATION = 'roleWithDuration', ABBREVIATED_NUMBER = 'abbreviatedNumber', - GLOBAL_USER = 'globalUser', + GLOBAL_USER = 'globalUser' } export enum BushBlockedReasonsEnum { @@ -501,7 +501,7 @@ export enum BushBlockedReasonsEnum { GUILD = 'guild', DM = 'dm', AUTHOR_NOT_FOUND = 'authorNotFound', - NOT_NSFW = "notNsfw", + NOT_NSFW = 'notNsfw', DISABLED_GUILD = 'disabledGuild', DISABLED_GLOBAL = 'disabledGlobal', ROLE_BLACKLIST = 'roleBlacklist', @@ -514,26 +514,26 @@ export enum BushBlockedReasonsEnum { } export enum BushCommandHandlerEventsEnum { - COMMAND_BLOCKED = "commandBlocked", - COMMAND_BREAKOUT = "commandBreakout", - COMMAND_CANCELLED = "commandCancelled", - COMMAND_FINISHED = "commandFinished", - COMMAND_INVALID = "commandInvalid", - COMMAND_LOCKED = "commandLocked", - COMMAND_STARTED = "commandStarted", - COOLDOWN = "cooldown", - ERROR = "error", - IN_PROMPT = "inPrompt", - MESSAGE_BLOCKED = "messageBlocked", - MESSAGE_INVALID = "messageInvalid", - MISSING_PERMISSIONS = "missingPermissions", - SLASH_BLOCKED = "slashBlocked", - SLASH_ERROR = "slashError", - SLASH_FINISHED = "slashFinished", - SLASH_MISSING_PERMISSIONS = "slashMissingPermissions", - SLASH_NOT_FOUND = "slashNotFound", - SLASH_STARTED = "slashStarted", - SLASH_ONLY = "slashOnly" + COMMAND_BLOCKED = 'commandBlocked', + COMMAND_BREAKOUT = 'commandBreakout', + COMMAND_CANCELLED = 'commandCancelled', + COMMAND_FINISHED = 'commandFinished', + COMMAND_INVALID = 'commandInvalid', + COMMAND_LOCKED = 'commandLocked', + COMMAND_STARTED = 'commandStarted', + COOLDOWN = 'cooldown', + ERROR = 'error', + IN_PROMPT = 'inPrompt', + MESSAGE_BLOCKED = 'messageBlocked', + MESSAGE_INVALID = 'messageInvalid', + MISSING_PERMISSIONS = 'missingPermissions', + SLASH_BLOCKED = 'slashBlocked', + SLASH_ERROR = 'slashError', + SLASH_FINISHED = 'slashFinished', + SLASH_MISSING_PERMISSIONS = 'slashMissingPermissions', + SLASH_NOT_FOUND = 'slashNotFound', + SLASH_STARTED = 'slashStarted', + SLASH_ONLY = 'slashOnly' } interface bushColors { @@ -562,5 +562,5 @@ interface bushColors { discord: ConstantsColors; } -export type PronounCode = keyof typeof PronounMap -export type Pronoun = PronounMap
\ No newline at end of file +export type PronounCode = keyof typeof PronounMap; +export type Pronoun = PronounMap; |