diff options
Diffstat (limited to 'src')
31 files changed, 135 insertions, 72 deletions
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts index efaa4dd..9c4991f 100644 --- a/src/arguments/discordEmoji.ts +++ b/src/arguments/discordEmoji.ts @@ -1,5 +1,5 @@ import type { BushArgumentTypeCaster } from '#lib'; -import type { Snowflake } from 'discord-api-types'; +import type { Snowflake } from 'discord-api-types/v9'; export const discordEmoji: BushArgumentTypeCaster<DiscordEmojiInfo | null> = (_, phrase) => { if (!phrase) return null; diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index 378893e..dddbac4 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib'; -import type { APIEmbed } from 'discord-api-types'; +import type { APIEmbed } from 'discord-api-types/v9'; import type { Guild } from 'discord.js'; export default class ServersCommand extends BushCommand { diff --git a/src/lib/common/HighlightManager.ts b/src/lib/common/HighlightManager.ts index 6194255..83506bc 100644 --- a/src/lib/common/HighlightManager.ts +++ b/src/lib/common/HighlightManager.ts @@ -24,7 +24,15 @@ export class HighlightManager { */ public readonly userBlocks = new Collection< /* guild */ Snowflake, - Collection</* word */ Snowflake, /* users */ Set<Snowflake>> + Collection</* user */ Snowflake, /* users */ Set<Snowflake>> + >(); + + /** + * Channels that users have blocked + */ + public readonly channelBlocks = new Collection< + /* guild */ Snowflake, + Collection</* user */ Snowflake, /* channels */ Set<Snowflake>> >(); /** @@ -66,7 +74,17 @@ export class HighlightManager { for (const [word, users] of guildCache.entries()) { if (this.isMatch(message.content, word)) { for (const user of users) { - if (!ret.has(user)) ret.set(user, word); + if (!ret.has(user)) { + if (!message.channel.permissionsFor(user)?.has('ViewChannel')) continue; + + const blockedUsers = this.userBlocks.get(message.guildId)?.get(user) ?? new Set(); + if (blockedUsers.has(message.author.id)) continue; + + const blockedChannels = this.channelBlocks.get(message.guildId)?.get(user) ?? new Set(); + if (blockedChannels.has(message.channel.id)) continue; + + ret.set(user, word); + } } } } diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 266680a..fa6dc53 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -110,7 +110,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); */ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> { public declare channels: BushChannelManager; - public declare readonly emojis: BushBaseGuildEmojiManager; public declare guilds: BushGuildManager; public declare user: If<Ready, BushClientUser>; public declare users: BushUserManager; @@ -499,6 +498,8 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re } export interface BushClient extends EventEmitter, PatchedElements { + get emojis(): BushBaseGuildEmojiManager; + 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; diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts index 24a7b22..68153b9 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts @@ -6,7 +6,7 @@ import type { BushGuildResolvable, StripPrivate } from '#lib'; -import type { APIApplicationCommand } from 'discord-api-types'; +import type { APIApplicationCommand } from 'discord-api-types/v9'; import { ApplicationCommandManager, CachedManager, diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts index f07bde9..49d4234 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts @@ -1,5 +1,5 @@ import type { BushClient, BushRoleResolvable, BushUserResolvable } from '#lib'; -import type { APIApplicationCommandPermission } from 'discord-api-types'; +import type { APIApplicationCommandPermission } from 'discord-api-types/v9'; import { ApplicationCommandPermissionType, BaseManager, diff --git a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts index 9b260dc..5444a7f 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts @@ -16,10 +16,13 @@ export class BushBaseGuildTextChannel extends BaseGuildTextChannel { public declare threads: BushThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>; public declare readonly client: BushClient; public declare guild: BushGuild; - public declare readonly members: Collection<Snowflake, BushGuildMember>; - public declare readonly parent: BushCategoryChannel | null; public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { super(guild, data, client, immediatePatch); } } + +export interface BushBaseGuildTextChannel { + get members(): Collection<Snowflake, BushGuildMember>; + get parent(): BushCategoryChannel | null; +} diff --git a/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts index 1ebefee..ba41cfe 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts @@ -7,7 +7,7 @@ import { BushGuildMember } from './BushGuildMember.js'; * Represents a voice-based guild channel on Discord. */ export declare class BushBaseGuildVoiceChannel extends BaseGuildVoiceChannel { - public readonly members: Collection<Snowflake, BushGuildMember>; + public get members(): Collection<Snowflake, BushGuildMember>; public guild: BushGuild; - public readonly parent: BushCategoryChannel | null; + public get parent(): BushCategoryChannel | null; } diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index b7ad77c..e72e277 100644 --- a/src/lib/extensions/discord.js/BushButtonInteraction.ts +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -1,5 +1,5 @@ import type { BushClient, BushGuild, BushGuildMember, BushGuildTextBasedChannel, BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types'; +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'; @@ -7,14 +7,6 @@ import type { RawMessageButtonInteractionData } from 'discord.js/typings/rawData * Represents a button interaction. */ export class BushButtonInteraction<Cached extends CacheType = CacheType> extends ButtonInteraction<Cached> { - public declare readonly channel: CacheTypeReducer< - Cached, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushTextBasedChannel | null - >; - public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; @@ -22,3 +14,14 @@ export class BushButtonInteraction<Cached extends CacheType = CacheType> extends super(client, data); } } + +export interface BushButtonInteraction<Cached extends CacheType = CacheType> { + get channel(): CacheTypeReducer< + Cached, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushTextBasedChannel | null + >; + get guild(): CacheTypeReducer<Cached, BushGuild, null>; +} diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts index 3868b54..8c02a68 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannel.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts @@ -21,7 +21,6 @@ import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; */ export class BushCategoryChannel extends CategoryChannel { public declare readonly client: BushClient; - public declare readonly children: BushCategoryChannelChildManager; public declare guild: BushGuild; public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { @@ -30,6 +29,7 @@ export class BushCategoryChannel extends CategoryChannel { } export interface BushCategoryChannel extends CategoryChannel { + get children(): BushCategoryChannelChildManager; isText(): this is BushTextChannel; isDM(): this is BushDMChannel; isVoice(): this is BushVoiceChannel; diff --git a/src/lib/extensions/discord.js/BushChannel.ts b/src/lib/extensions/discord.js/BushChannel.ts index 8779342..3f0d070 100644 --- a/src/lib/extensions/discord.js/BushChannel.ts +++ b/src/lib/extensions/discord.js/BushChannel.ts @@ -20,11 +20,11 @@ import type { RawChannelData } from 'discord.js/typings/rawDataTypes'; */ export declare class BushChannel extends Channel { public constructor(client: BushClient, data?: RawChannelData, immediatePatch?: boolean); - public readonly createdAt: Date | null; - public readonly createdTimestamp: number | null; + public get createdAt(): Date | null; + public get createdTimestamp(): number | null; public deleted: boolean; public id: Snowflake; - public readonly partial: false; + public get partial(): false; public type: ChannelType; public delete(): Promise<this>; public fetch(force?: boolean): Promise<this>; diff --git a/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts index 4d68f79..5dbf7b9 100644 --- a/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts +++ b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts @@ -10,7 +10,7 @@ import type { BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types'; +import type { APIInteractionGuildMember } from 'discord-api-types/v9'; import { ChatInputCommandInteraction, type CacheType, type CacheTypeReducer, type Invite, type Snowflake } from 'discord.js'; import type { RawCommandInteractionData } from 'discord.js/typings/rawDataTypes'; @@ -28,15 +28,6 @@ export type BushGuildResolvable = */ export class BushChatInputCommandInteraction<Cached extends CacheType = CacheType> extends ChatInputCommandInteraction<Cached> { public declare readonly client: BushClient; - public declare readonly command: BushApplicationCommand | BushApplicationCommand<{ guild: BushGuildResolvable }> | null; - public declare readonly channel: CacheTypeReducer< - Cached, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushTextBasedChannel | null - >; - public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; @@ -44,3 +35,15 @@ export class BushChatInputCommandInteraction<Cached extends CacheType = CacheTyp super(client, data); } } + +export interface BushChatInputCommandInteraction<Cached extends CacheType = CacheType> { + get command(): BushApplicationCommand | BushApplicationCommand<{ guild: BushGuildResolvable }> | null; + get channel(): CacheTypeReducer< + Cached, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushTextBasedChannel | null + >; + get guild(): CacheTypeReducer<Cached, BushGuild, null>; +} diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 155f32c..a131242 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -32,7 +32,6 @@ import { ModLogType } from '../../models/instance/ModLog.js'; */ export class BushGuild extends Guild { public declare readonly client: BushClient; - public declare readonly me: BushGuildMember | null; public declare members: BushGuildMemberManager; public declare channels: BushGuildChannelManager; @@ -452,6 +451,10 @@ export class BushGuild extends Guild { } } +export interface BushGuild { + get me(): BushGuildMember | null; +} + /** * Options for unbanning a user */ diff --git a/src/lib/extensions/discord.js/BushGuildBan.ts b/src/lib/extensions/discord.js/BushGuildBan.ts index 496e798..d56c531 100644 --- a/src/lib/extensions/discord.js/BushGuildBan.ts +++ b/src/lib/extensions/discord.js/BushGuildBan.ts @@ -9,7 +9,7 @@ export declare class BushGuildBan extends GuildBan { public constructor(client: BushClient, data: RawGuildBanData, guild: BushGuild); public guild: BushGuild; public user: BushUser; - public readonly partial: boolean; + public get partial(): boolean; public reason?: string | null; public fetch(force?: boolean): Promise<BushGuildBan>; } diff --git a/src/lib/extensions/discord.js/BushGuildEmoji.ts b/src/lib/extensions/discord.js/BushGuildEmoji.ts index 2c9d36b..29e0c4a 100644 --- a/src/lib/extensions/discord.js/BushGuildEmoji.ts +++ b/src/lib/extensions/discord.js/BushGuildEmoji.ts @@ -9,9 +9,12 @@ export class BushGuildEmoji extends GuildEmoji { public declare readonly client: BushClient; public declare guild: BushGuild; public declare author: BushUser | null; - public declare readonly roles: BushGuildEmojiRoleManager; public constructor(client: BushClient, data: RawGuildEmojiData, guild: BushGuild) { super(client, data, guild); } } + +export interface BushGuildEmoji { + get roles(): BushGuildEmojiRoleManager; +} diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 420f8f5..c424d12 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -34,10 +34,7 @@ export type PartialBushMessage = Partialize< export class BushMessage<Cached extends boolean = boolean> extends Message<Cached> { public declare readonly client: BushClient; public declare util: BushCommandUtil<BushMessage<true>>; - public declare readonly guild: If<Cached, BushGuild>; - public declare readonly member: BushGuildMember | null; public declare author: BushUser; - public declare readonly channel: If<Cached, BushGuildTextBasedChannel, BushTextBasedChannel>; public constructor(client: BushClient, data: RawMessageData) { super(client, data); @@ -45,6 +42,9 @@ export class BushMessage<Cached extends boolean = boolean> extends Message<Cache } export interface BushMessage<Cached extends boolean = boolean> extends Message<Cached> { + get guild(): If<Cached, BushGuild>; + get member(): BushGuildMember | null; + get channel(): If<Cached, BushGuildTextBasedChannel, BushTextBasedChannel>; delete(): Promise<BushMessage>; edit(content: string | MessageEditOptions | MessagePayload): Promise<BushMessage>; equals(message: BushMessage, rawData: unknown): boolean; diff --git a/src/lib/extensions/discord.js/BushMessageManager.ts b/src/lib/extensions/discord.js/BushMessageManager.ts index 7ed4199..80b7a21 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.ts @@ -29,7 +29,7 @@ export declare class BushMessageManager /** * The cache of Messages */ - public cache: Collection<Snowflake, BushMessage>; + public get cache(): Collection<Snowflake, BushMessage>; /** * Publishes a message in an announcement channel to all channels following it, even if it's not cached. diff --git a/src/lib/extensions/discord.js/BushMessageReaction.ts b/src/lib/extensions/discord.js/BushMessageReaction.ts index 47d4119..aed76df 100644 --- a/src/lib/extensions/discord.js/BushMessageReaction.ts +++ b/src/lib/extensions/discord.js/BushMessageReaction.ts @@ -9,9 +9,12 @@ export type PartialBushMessageReaction = Partialize<BushMessageReaction, 'count' */ export class BushMessageReaction extends MessageReaction { public declare readonly client: BushClient; - public declare readonly emoji: BushGuildEmoji | BushReactionEmoji; public constructor(client: BushClient, data: RawMessageReactionData, message: BushMessage) { super(client, data, message); } } + +export interface BushMessageReaction { + get emoji(): BushGuildEmoji | BushReactionEmoji; +} diff --git a/src/lib/extensions/discord.js/BushNewsChannel.ts b/src/lib/extensions/discord.js/BushNewsChannel.ts index 7df7f37..fcb15d5 100644 --- a/src/lib/extensions/discord.js/BushNewsChannel.ts +++ b/src/lib/extensions/discord.js/BushNewsChannel.ts @@ -8,5 +8,8 @@ export class BushNewsChannel extends NewsChannel { public declare threads: BushThreadManager<AllowedThreadTypeForNewsChannel>; public declare guild: BushGuild; public declare messages: BushMessageManager; - public declare members: Collection<Snowflake, BushGuildMember>; +} + +export interface BushNewsChannel { + get members(): Collection<Snowflake, BushGuildMember>; } diff --git a/src/lib/extensions/discord.js/BushPresence.ts b/src/lib/extensions/discord.js/BushPresence.ts index f0a3ba6..f40570d 100644 --- a/src/lib/extensions/discord.js/BushPresence.ts +++ b/src/lib/extensions/discord.js/BushPresence.ts @@ -7,10 +7,13 @@ import type { RawPresenceData } from 'discord.js/typings/rawDataTypes'; */ export class BushPresence extends Presence { public declare guild: BushGuild | null; - public declare readonly member: BushGuildMember | null; - public declare readonly user: BushUser | null; public constructor(client: BushClient, data?: RawPresenceData) { super(client, data); } } + +export interface BushPresence { + get member(): BushGuildMember | null; + get user(): BushUser | null; +} diff --git a/src/lib/extensions/discord.js/BushRole.ts b/src/lib/extensions/discord.js/BushRole.ts index acf795d..c0b9ae5 100644 --- a/src/lib/extensions/discord.js/BushRole.ts +++ b/src/lib/extensions/discord.js/BushRole.ts @@ -7,9 +7,12 @@ import type { RawRoleData } from 'discord.js/typings/rawDataTypes'; */ export class BushRole extends Role { public declare guild: BushGuild; - public declare readonly members: Collection<Snowflake, BushGuildMember>; public constructor(client: BushClient, data: RawRoleData, guild: BushGuild) { super(client, data, guild); } } + +export interface BushRole { + get members(): Collection<Snowflake, BushGuildMember>; +} diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index 2c7c329..e5f84b4 100644 --- a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -1,5 +1,5 @@ import type { BushClient, BushGuild, BushGuildMember, BushGuildTextBasedChannel, BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types'; +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'; @@ -7,14 +7,6 @@ import type { RawMessageSelectMenuInteractionData } from 'discord.js/typings/raw * Represents a select menu interaction. */ export class BushSelectMenuInteraction<Cached extends CacheType = CacheType> extends SelectMenuInteraction<Cached> { - public declare readonly channel: CacheTypeReducer< - Cached, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushGuildTextBasedChannel | null, - BushTextBasedChannel | null - >; - public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; @@ -22,3 +14,14 @@ export class BushSelectMenuInteraction<Cached extends CacheType = CacheType> ext super(client, data); } } + +export interface BushSelectMenuInteraction<Cached extends CacheType = CacheType> { + get channel(): CacheTypeReducer< + Cached, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushGuildTextBasedChannel | null, + BushTextBasedChannel | null + >; + get guild(): CacheTypeReducer<Cached, BushGuild, null>; +} diff --git a/src/lib/extensions/discord.js/BushStageChannel.ts b/src/lib/extensions/discord.js/BushStageChannel.ts index 5f6c581..253b417 100644 --- a/src/lib/extensions/discord.js/BushStageChannel.ts +++ b/src/lib/extensions/discord.js/BushStageChannel.ts @@ -6,12 +6,15 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; * Represents a guild stage channel on Discord. */ export class BushStageChannel extends StageChannel { - public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare guild: BushGuild; - public declare readonly parent: BushCategoryChannel | null; - public declare readonly stageInstance: BushStageInstance | null; public constructor(guild: BushGuild, data?: RawGuildChannelData) { super(guild, data); } } + +export interface BushStageChannel { + get members(): Collection<Snowflake, BushGuildMember>; + get parent(): BushCategoryChannel | null; + get stageInstance(): BushStageInstance | null; +} diff --git a/src/lib/extensions/discord.js/BushStageInstance.ts b/src/lib/extensions/discord.js/BushStageInstance.ts index 80fa5cf..0242314 100644 --- a/src/lib/extensions/discord.js/BushStageInstance.ts +++ b/src/lib/extensions/discord.js/BushStageInstance.ts @@ -6,10 +6,12 @@ import type { RawStageInstanceData } from 'discord.js/typings/rawDataTypes'; * Represents a stage instance. */ export class BushStageInstance extends StageInstance { - public declare readonly channel: BushStageChannel | null; - public declare readonly guild: BushGuild | null; - public constructor(client: BushClient, data: RawStageInstanceData, channel: BushStageChannel) { super(client, data, channel); } } + +export interface BushStageInstance { + get channel(): BushStageChannel | null; + get guild(): BushGuild | null; +} diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts index eadc8af..a2cc114 100644 --- a/src/lib/extensions/discord.js/BushStoreChannel.ts +++ b/src/lib/extensions/discord.js/BushStoreChannel.ts @@ -23,8 +23,6 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; */ export class BushStoreChannel extends StoreChannel { public declare guild: BushGuild; - public declare readonly members: Collection<Snowflake, BushGuildMember>; - public declare readonly parent: BushCategoryChannel | null; public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient) { super(guild, data, client); @@ -32,6 +30,8 @@ export class BushStoreChannel extends StoreChannel { } export interface BushStoreChannel extends StoreChannel { + get members(): Collection<Snowflake, BushGuildMember>; + get parent(): BushCategoryChannel | null; isText(): this is BushTextChannel; isDM(): this is BushDMChannel; isDMBased(): this is PartialGroupDMChannel | BushDMChannel; diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts index 691fabf..5663ba4 100644 --- a/src/lib/extensions/discord.js/BushThreadChannel.ts +++ b/src/lib/extensions/discord.js/BushThreadChannel.ts @@ -27,8 +27,6 @@ export class BushThreadChannel extends ThreadChannel { public declare messages: BushMessageManager; public declare members: BushThreadMemberManager; public declare readonly client: BushClient; - public declare readonly guildMembers: Collection<Snowflake, BushGuildMember>; - public declare readonly parent: BushTextChannel | BushNewsChannel | null; public constructor(guild: BushGuild, data?: RawThreadChannelData, client?: BushClient, fromInteraction?: boolean) { super(guild, data, client, fromInteraction); @@ -36,6 +34,8 @@ export class BushThreadChannel extends ThreadChannel { } export interface BushThreadChannel extends ThreadChannel { + get guildMembers(): Collection<Snowflake, BushGuildMember>; + get parent(): BushTextChannel | BushNewsChannel | null; isText(): this is BushTextChannel; isDM(): this is BushDMChannel; isDMBased(): this is PartialGroupDMChannel | BushDMChannel; diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts index a316046..b3d8b50 100644 --- a/src/lib/extensions/discord.js/BushThreadMember.ts +++ b/src/lib/extensions/discord.js/BushThreadMember.ts @@ -6,11 +6,14 @@ import type { RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; * Represents a Member for a Thread. */ export class BushThreadMember extends ThreadMember { - public declare readonly guildMember: BushGuildMember | null; - public declare readonly user: BushUser | null; public declare thread: BushThreadChannel; public constructor(thread: BushThreadChannel, data?: RawThreadMemberData) { super(thread, data); } } + +export interface BushThreadMember { + get guildMember(): BushGuildMember | null; + get user(): BushUser | null; +} diff --git a/src/lib/extensions/discord.js/BushUser.ts b/src/lib/extensions/discord.js/BushUser.ts index 5ab288e..10e2e4a 100644 --- a/src/lib/extensions/discord.js/BushUser.ts +++ b/src/lib/extensions/discord.js/BushUser.ts @@ -9,7 +9,6 @@ export type PartialBushUser = Partialize<BushUser, 'username' | 'tag' | 'discrim */ export class BushUser extends User { public declare readonly client: BushClient; - public declare readonly dmChannel: BushDMChannel | null; public constructor(client: BushClient, data: RawUserData) { super(client, data); @@ -29,3 +28,7 @@ export class BushUser extends User { return client.isSuperUser(this); } } + +export interface BushUser { + get dmChannel(): BushDMChannel | null; +} diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts index a0ee47d..6691045 100644 --- a/src/lib/extensions/discord.js/BushVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts @@ -22,7 +22,6 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; */ export class BushVoiceChannel extends VoiceChannel { public declare readonly client: BushClient; - public declare readonly members: Collection<Snowflake, BushGuildMember>; public constructor(guild: BushGuild, data?: RawGuildChannelData) { super(guild, data); @@ -30,6 +29,7 @@ export class BushVoiceChannel extends VoiceChannel { } export interface BushVoiceChannel extends VoiceChannel { + get members(): Collection<Snowflake, BushGuildMember>; isText(): this is BushTextChannel; isDM(): this is BushDMChannel; isVoice(): this is BushVoiceChannel; diff --git a/src/lib/extensions/discord.js/BushVoiceState.ts b/src/lib/extensions/discord.js/BushVoiceState.ts index 3f19201..f5c6301 100644 --- a/src/lib/extensions/discord.js/BushVoiceState.ts +++ b/src/lib/extensions/discord.js/BushVoiceState.ts @@ -7,11 +7,14 @@ import type { RawVoiceStateData } from 'discord.js/typings/rawDataTypes'; */ export class BushVoiceState extends VoiceState { public declare readonly client: BushClient; - public declare readonly channel: BushVoiceBasedChannel | null; public declare guild: BushGuild; - public declare readonly member: BushGuildMember | null; public constructor(guild: BushGuild, data: RawVoiceStateData) { super(guild, data); } } + +export interface BushVoiceState { + get channel(): BushVoiceBasedChannel | null; + get getmember(): BushGuildMember | null; +} diff --git a/src/listeners/message/highlight.ts b/src/listeners/message/highlight.ts index d3d7bfb..c751ad5 100644 --- a/src/listeners/message/highlight.ts +++ b/src/listeners/message/highlight.ts @@ -11,7 +11,7 @@ export default class HighlightListener extends BushListener { public override async exec(...[message]: BushClientEvents['messageCreate']) { if (!message.inGuild()) return; - if (message.author.bot) return; + if (message.author.bot || message.system) return; if (!(await message.guild.hasFeature('highlight'))) return; // allows highlighting to be disabled on a guild-by-guild basis const res = client.highlightManager.checkMessage(message); |