aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-23 18:13:05 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-23 18:13:05 -0500
commita3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a (patch)
tree9b0f8ed8a93c22c90512751e3f2f5937e1925760 /src/lib/extensions/discord.js
parent5557677f1570eb564a30cfcebb6030235dc84d47 (diff)
downloadtanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.tar.gz
tanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.tar.bz2
tanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.zip
fix discord.js breaking changes, some other stuff
Diffstat (limited to 'src/lib/extensions/discord.js')
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandManager.ts (renamed from src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts)17
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts (renamed from src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts)6
-rw-r--r--src/lib/extensions/discord.js/BushBaseGuildEmojiManager.ts (renamed from src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts)7
-rw-r--r--src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts (renamed from src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.d.ts)2
-rw-r--r--src/lib/extensions/discord.js/BushCategoryChannel.ts31
-rw-r--r--src/lib/extensions/discord.js/BushChannel.d.ts24
-rw-r--r--src/lib/extensions/discord.js/BushChannel.ts41
-rw-r--r--src/lib/extensions/discord.js/BushChannelManager.ts (renamed from src/lib/extensions/discord.js/BushChannelManager.d.ts)7
-rw-r--r--src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts (renamed from src/lib/extensions/discord.js/BushCommandInteraction.ts)4
-rw-r--r--src/lib/extensions/discord.js/BushClientEvents.ts (renamed from src/lib/extensions/discord.js/BushClientEvents.d.ts)75
-rw-r--r--src/lib/extensions/discord.js/BushClientUser.ts (renamed from src/lib/extensions/discord.js/BushClientUser.d.ts)2
-rw-r--r--src/lib/extensions/discord.js/BushDMChannel.ts28
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts42
-rw-r--r--src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts (renamed from src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts)6
-rw-r--r--src/lib/extensions/discord.js/BushGuildBan.ts (renamed from src/lib/extensions/discord.js/BushGuildBan.d.ts)2
-rw-r--r--src/lib/extensions/discord.js/BushGuildChannel.ts30
-rw-r--r--src/lib/extensions/discord.js/BushGuildChannelManager.ts (renamed from src/lib/extensions/discord.js/BushGuildChannelManager.d.ts)12
-rw-r--r--src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts (renamed from src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts)7
-rw-r--r--src/lib/extensions/discord.js/BushGuildManager.ts (renamed from src/lib/extensions/discord.js/BushGuildManager.d.ts)3
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts65
-rw-r--r--src/lib/extensions/discord.js/BushGuildMemberManager.ts (renamed from src/lib/extensions/discord.js/BushGuildMemberManager.d.ts)6
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts4
-rw-r--r--src/lib/extensions/discord.js/BushMessageManager.ts (renamed from src/lib/extensions/discord.js/BushMessageManager.d.ts)10
-rw-r--r--src/lib/extensions/discord.js/BushStoreChannel.ts31
-rw-r--r--src/lib/extensions/discord.js/BushTextChannel.ts30
-rw-r--r--src/lib/extensions/discord.js/BushThreadChannel.ts22
-rw-r--r--src/lib/extensions/discord.js/BushThreadManager.ts (renamed from src/lib/extensions/discord.js/BushThreadManager.d.ts)8
-rw-r--r--src/lib/extensions/discord.js/BushThreadMemberManager.ts (renamed from src/lib/extensions/discord.js/BushThreadMemberManager.d.ts)34
-rw-r--r--src/lib/extensions/discord.js/BushUserManager.ts (renamed from src/lib/extensions/discord.js/BushUserManager.d.ts)7
-rw-r--r--src/lib/extensions/discord.js/BushVoiceChannel.ts30
-rw-r--r--src/lib/extensions/discord.js/other.ts54
31 files changed, 432 insertions, 215 deletions
diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts
index 2aa366d..24a7b22 100644
--- a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
+++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts
@@ -3,10 +3,12 @@ import type {
BushApplicationCommandPermissionsManager,
BushApplicationCommandResolvable,
BushClient,
- BushGuildResolvable
+ BushGuildResolvable,
+ StripPrivate
} from '#lib';
import type { APIApplicationCommand } from 'discord-api-types';
import {
+ ApplicationCommandManager,
CachedManager,
type ApplicationCommandData,
type Collection,
@@ -17,11 +19,14 @@ import {
/**
* Manages API methods for application commands and stores their cache.
*/
-export class BushApplicationCommandManager<
- ApplicationCommandScope = BushApplicationCommand<{ guild: BushGuildResolvable }>,
- PermissionsOptionsExtras = { guild: BushGuildResolvable },
- PermissionsGuildType = null
-> extends CachedManager<Snowflake, ApplicationCommandScope, BushApplicationCommandResolvable> {
+export declare class BushApplicationCommandManager<
+ ApplicationCommandScope = BushApplicationCommand<{ guild: BushGuildResolvable }>,
+ PermissionsOptionsExtras = { guild: BushGuildResolvable },
+ PermissionsGuildType = null
+ >
+ extends CachedManager<Snowflake, ApplicationCommandScope, BushApplicationCommandResolvable>
+ implements StripPrivate<ApplicationCommandManager<ApplicationCommandScope, PermissionsOptionsExtras, PermissionsGuildType>>
+{
public constructor(client: BushClient, iterable?: Iterable<unknown>);
/**
diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts
index ff32be4..f07bde9 100644
--- a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts
+++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts
@@ -1,6 +1,7 @@
import type { BushClient, BushRoleResolvable, BushUserResolvable } from '#lib';
import type { APIApplicationCommandPermission } from 'discord-api-types';
import {
+ ApplicationCommandPermissionType,
BaseManager,
type ApplicationCommand,
type ApplicationCommandManager,
@@ -11,12 +12,11 @@ import {
type GuildApplicationCommandPermissionData,
type Snowflake
} from 'discord.js';
-import type { ApplicationCommandPermissionTypes } from 'discord.js/typings/enums';
/**
* Manages API methods for permissions of Application Commands.
*/
-export class BushApplicationCommandPermissionsManager<
+export declare class BushApplicationCommandPermissionsManager<
BaseOptions,
FetchSingleOptions,
FullPermissionsOptions,
@@ -179,6 +179,6 @@ export class BushApplicationCommandPermissionsManager<
private static transformPermissions(
permissions: ApplicationCommandPermissionData,
received: true
- ): Omit<APIApplicationCommandPermission, 'type'> & { type: keyof ApplicationCommandPermissionTypes };
+ ): Omit<APIApplicationCommandPermission, 'type'> & { type: keyof ApplicationCommandPermissionType };
private static transformPermissions(permissions: ApplicationCommandPermissionData): APIApplicationCommandPermission;
}
diff --git a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.ts
index 347ff65..66abbc2 100644
--- a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts
+++ b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.ts
@@ -1,11 +1,14 @@
import type { BushClient, BushEmojiIdentifierResolvable, BushEmojiResolvable, BushGuildEmoji } from '#lib';
-import { CachedManager, type Snowflake } from 'discord.js';
+import { BaseGuildEmojiManager, CachedManager, type Snowflake } from 'discord.js';
import { type RawGuildEmojiData } from 'discord.js/typings/rawDataTypes';
/**
* Holds methods to resolve GuildEmojis and stores their cache.
*/
-export class BushBaseGuildEmojiManager extends CachedManager<Snowflake, BushGuildEmoji, BushEmojiResolvable> {
+export declare class BushBaseGuildEmojiManager
+ extends CachedManager<Snowflake, BushGuildEmoji, BushEmojiResolvable>
+ implements BaseGuildEmojiManager
+{
public constructor(client: BushClient, iterable?: Iterable<RawGuildEmojiData>);
/**
diff --git a/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.d.ts b/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts
index 21be206..2ffb2fd 100644
--- a/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.d.ts
+++ b/src/lib/extensions/discord.js/BushBaseGuildVoiceChannel.ts
@@ -6,7 +6,7 @@ import { BushGuildMember } from './BushGuildMember';
/**
* Represents a voice-based guild channel on Discord.
*/
-export class BushBaseGuildVoiceChannel extends BaseGuildVoiceChannel {
+export declare class BushBaseGuildVoiceChannel extends BaseGuildVoiceChannel {
public readonly members: Collection<Snowflake, BushGuildMember>;
public guild: BushGuild;
public readonly parent: BushCategoryChannel | null;
diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts
index b711a54..ac82bf0 100644
--- a/src/lib/extensions/discord.js/BushCategoryChannel.ts
+++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts
@@ -1,4 +1,19 @@
-import { BushNonThreadGuildBasedChannel, type BushClient, type BushGuild, type BushGuildMember } from '#lib';
+import {
+ BushDMChannel,
+ BushGuildBasedChannel,
+ BushNewsChannel,
+ BushNonThreadGuildBasedChannel,
+ BushStageChannel,
+ BushStoreChannel,
+ BushTextBasedChannel,
+ BushTextChannel,
+ BushThreadChannel,
+ BushVoiceBasedChannel,
+ BushVoiceChannel,
+ type BushClient,
+ type BushGuild,
+ type BushGuildMember
+} from '#lib';
import { CategoryChannel, type Collection, type Snowflake } from 'discord.js';
import { type RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
@@ -16,3 +31,17 @@ export class BushCategoryChannel extends CategoryChannel {
super(guild, data, client, immediatePatch);
}
}
+
+export interface BushCategoryChannel extends CategoryChannel {
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ // eslint-disable-next-line deprecation/deprecation
+ isStore(): this is BushStoreChannel;
+ isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/BushChannel.d.ts b/src/lib/extensions/discord.js/BushChannel.d.ts
deleted file mode 100644
index 42443ba..0000000
--- a/src/lib/extensions/discord.js/BushChannel.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type { BushClient, BushTextBasedChannel, BushThreadChannel } 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';
-import { BushBaseGuildVoiceChannel } from './BushBaseGuildVoiceChannel';
-
-/**
- * Represents any channel on Discord.
- */
-export class BushChannel extends Channel {
- public constructor(client: BushClient, data?: RawChannelData, immediatePatch?: boolean);
- public readonly createdAt: Date;
- public readonly createdTimestamp: number;
- public deleted: boolean;
- public id: Snowflake;
- public readonly partial: false;
- public type: keyof typeof ChannelTypes;
- public delete(): Promise<this>;
- public fetch(force?: boolean): Promise<this>;
- public isText(): this is BushTextBasedChannel;
- public isVoice(): this is BushBaseGuildVoiceChannel;
- public isThread(): this is BushThreadChannel;
- public toString(): ChannelMention;
-}
diff --git a/src/lib/extensions/discord.js/BushChannel.ts b/src/lib/extensions/discord.js/BushChannel.ts
new file mode 100644
index 0000000..50ec723
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushChannel.ts
@@ -0,0 +1,41 @@
+/* eslint-disable deprecation/deprecation */
+import type {
+ BushCategoryChannel,
+ BushClient,
+ BushDMChannel,
+ BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
+ BushTextBasedChannel,
+ BushTextChannel,
+ BushThreadChannel,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
+} from '#lib';
+import { Channel, ChannelType, type Snowflake } from 'discord.js';
+import type { RawChannelData } from 'discord.js/typings/rawDataTypes';
+
+/**
+ * Represents any channel on Discord.
+ */
+export declare class BushChannel extends Channel {
+ public constructor(client: BushClient, data?: RawChannelData, immediatePatch?: boolean);
+ public readonly createdAt: Date;
+ public readonly createdTimestamp: number;
+ public deleted: boolean;
+ public id: Snowflake;
+ public readonly partial: false;
+ public type: ChannelType;
+ public delete(): Promise<this>;
+ public fetch(force?: boolean): Promise<this>;
+ public isText(): this is BushTextChannel;
+ public isDM(): this is BushDMChannel;
+ public isVoice(): this is BushVoiceChannel;
+ public isCategory(): this is BushCategoryChannel;
+ public isNews(): this is BushNewsChannel;
+ public isStore(): this is BushStoreChannel;
+ public isThread(): this is BushThreadChannel;
+ public isStage(): this is BushStageChannel;
+ public isTextBased(): this is BushTextBasedChannel;
+ public isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/BushChannelManager.d.ts b/src/lib/extensions/discord.js/BushChannelManager.ts
index 514cdd3..ff93209 100644
--- a/src/lib/extensions/discord.js/BushChannelManager.d.ts
+++ b/src/lib/extensions/discord.js/BushChannelManager.ts
@@ -1,11 +1,14 @@
import type { BushAnyChannel, BushChannelResolvable } from '#lib';
-import { CachedManager, type Client, type FetchChannelOptions, type Snowflake } from 'discord.js';
+import { CachedManager, ChannelManager, type Client, type FetchChannelOptions, type Snowflake } from 'discord.js';
import type { RawChannelData } from 'discord.js/typings/rawDataTypes';
/**
* A manager of channels belonging to a client
*/
-export class BushChannelManager extends CachedManager<Snowflake, BushAnyChannel, BushChannelResolvable> {
+export declare class BushChannelManager
+ extends CachedManager<Snowflake, BushAnyChannel, BushChannelResolvable>
+ implements ChannelManager
+{
public constructor(client: Client, iterable: Iterable<RawChannelData>);
/**
diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts
index f4be5ed..56bef21 100644
--- a/src/lib/extensions/discord.js/BushCommandInteraction.ts
+++ b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts
@@ -11,7 +11,7 @@ import type {
BushUser
} from '#lib';
import type { APIInteractionGuildMember } from '@discordjs/builders/node_modules/discord-api-types';
-import { CommandInteraction, type CacheType, type CacheTypeReducer, type Invite, type Snowflake } from 'discord.js';
+import { ChatInputCommandInteraction, type CacheType, type CacheTypeReducer, type Invite, type Snowflake } from 'discord.js';
import type { RawCommandInteractionData } from 'discord.js/typings/rawDataTypes';
export type BushGuildResolvable =
@@ -26,7 +26,7 @@ export type BushGuildResolvable =
/**
* Represents a command interaction.
*/
-export class BushCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> {
+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<
diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.ts
index b5ad749..02f0017 100644
--- a/src/lib/extensions/discord.js/BushClientEvents.d.ts
+++ b/src/lib/extensions/discord.js/BushClientEvents.ts
@@ -43,10 +43,7 @@ import type {
export interface BushClientEvents extends AkairoClientEvents {
applicationCommandCreate: [command: BushApplicationCommand];
applicationCommandDelete: [command: BushApplicationCommand];
- applicationCommandUpdate: [
- oldCommand: BushApplicationCommand | null,
- newCommand: BushApplicationCommand
- ];
+ applicationCommandUpdate: [oldCommand: BushApplicationCommand | null, newCommand: BushApplicationCommand];
channelCreate: [channel: BushNonThreadGuildBasedChannel];
channelDelete: [channel: BushDMChannel | BushNonThreadGuildBasedChannel];
channelPinsUpdate: [channel: BushTextBasedChannel, date: Date];
@@ -78,37 +75,18 @@ export interface BushClientEvents extends AkairoClientEvents {
nonce: string | undefined;
}
];
- guildMemberUpdate: [
- oldMember: BushGuildMember | PartialBushGuildMember,
- newMember: BushGuildMember
- ];
+ guildMemberUpdate: [oldMember: BushGuildMember | PartialBushGuildMember, newMember: BushGuildMember];
guildUpdate: [oldGuild: BushGuild, newGuild: BushGuild];
inviteCreate: [invite: Invite];
inviteDelete: [invite: Invite];
messageCreate: [message: BushMessage];
messageDelete: [message: BushMessage | PartialBushMessage];
- messageReactionRemoveAll: [
- message: BushMessage | PartialBushMessage,
- reactions: Collection<string, BushMessageReaction>
- ];
- messageReactionRemoveEmoji: [
- reaction: BushMessageReaction | PartialBushMessageReaction
- ];
- messageDeleteBulk: [
- messages: Collection<Snowflake, BushMessage | PartialBushMessage>
- ];
- messageReactionAdd: [
- reaction: BushMessageReaction | PartialBushMessageReaction,
- user: BushUser | PartialBushUser
- ];
- messageReactionRemove: [
- reaction: BushMessageReaction | PartialBushMessageReaction,
- user: BushUser | PartialBushUser
- ];
- messageUpdate: [
- oldMessage: BushMessage | PartialBushMessage,
- newMessage: BushMessage | PartialBushMessage
- ];
+ messageReactionRemoveAll: [message: BushMessage | PartialBushMessage, reactions: Collection<string, BushMessageReaction>];
+ messageReactionRemoveEmoji: [reaction: BushMessageReaction | PartialBushMessageReaction];
+ messageDeleteBulk: [messages: Collection<Snowflake, BushMessage | PartialBushMessage>];
+ messageReactionAdd: [reaction: BushMessageReaction | PartialBushMessageReaction, user: BushUser | PartialBushUser];
+ messageReactionRemove: [reaction: BushMessageReaction | PartialBushMessageReaction, user: BushUser | PartialBushUser];
+ messageUpdate: [oldMessage: BushMessage | PartialBushMessage, newMessage: BushMessage | PartialBushMessage];
presenceUpdate: [oldPresence: BushPresence | null, newPresence: BushPresence];
rateLimit: [rateLimitData: RateLimitData];
invalidRequestWarning: [invalidRequestWarningData: InvalidRequestWarningData];
@@ -120,14 +98,8 @@ export interface BushClientEvents extends AkairoClientEvents {
threadCreate: [thread: BushThreadChannel];
threadDelete: [thread: BushThreadChannel];
threadListSync: [threads: Collection<Snowflake, BushThreadChannel>];
- threadMemberUpdate: [
- oldMember: BushThreadMember,
- newMember: BushThreadMember
- ];
- threadMembersUpdate: [
- oldMembers: Collection<Snowflake, BushThreadMember>,
- newMembers: Collection<Snowflake, BushThreadMember>
- ];
+ threadMemberUpdate: [oldMember: BushThreadMember, newMember: BushThreadMember];
+ threadMembersUpdate: [oldMembers: Collection<Snowflake, BushThreadMember>, newMembers: Collection<Snowflake, BushThreadMember>];
threadUpdate: [oldThread: BushThreadChannel, newThread: BushThreadChannel];
typingStart: [typing: Typing];
userUpdate: [oldUser: BushUser | PartialBushUser, newUser: BushUser];
@@ -139,28 +111,16 @@ export interface BushClientEvents extends AkairoClientEvents {
shardReconnecting: [shardId: number];
shardResume: [shardId: number, replayedEvents: number];
stageInstanceCreate: [stageInstance: BushStageInstance];
- stageInstanceUpdate: [
- oldStageInstance: BushStageInstance | null,
- newStageInstance: BushStageInstance
- ];
+ stageInstanceUpdate: [oldStageInstance: BushStageInstance | null, newStageInstance: BushStageInstance];
stageInstanceDelete: [stageInstance: BushStageInstance];
stickerCreate: [sticker: Sticker];
stickerDelete: [sticker: Sticker];
stickerUpdate: [oldSticker: Sticker, newSticker: Sticker];
guildScheduledEventCreate: [guildScheduledEvent: GuildScheduledEvent];
- guildScheduledEventUpdate: [
- oldGuildScheduledEvent: GuildScheduledEvent,
- newGuildScheduledEvent: GuildScheduledEvent
- ];
+ guildScheduledEventUpdate: [oldGuildScheduledEvent: GuildScheduledEvent, newGuildScheduledEvent: GuildScheduledEvent];
guildScheduledEventDelete: [guildScheduledEvent: GuildScheduledEvent];
- guildScheduledEventUserAdd: [
- guildScheduledEvent: GuildScheduledEvent,
- user: BushUser
- ];
- guildScheduledEventUserRemove: [
- guildScheduledEvent: GuildScheduledEvent,
- user: BushUser
- ];
+ guildScheduledEventUserAdd: [guildScheduledEvent: GuildScheduledEvent, user: BushUser];
+ guildScheduledEventUserRemove: [guildScheduledEvent: GuildScheduledEvent, user: BushUser];
/* Custom */
bushBan: [
victim: BushGuildMember | BushUser,
@@ -318,9 +278,4 @@ export interface BushClientEvents extends AkairoClientEvents {
];
}
-type Setting =
- | GuildSettings
- | 'enabledFeatures'
- | 'blacklistedChannels'
- | 'blacklistedUsers'
- | 'disabledCommands';
+type Setting = GuildSettings | 'enabledFeatures' | 'blacklistedChannels' | 'blacklistedUsers' | 'disabledCommands';
diff --git a/src/lib/extensions/discord.js/BushClientUser.d.ts b/src/lib/extensions/discord.js/BushClientUser.ts
index 503413b..a9a47f9 100644
--- a/src/lib/extensions/discord.js/BushClientUser.d.ts
+++ b/src/lib/extensions/discord.js/BushClientUser.ts
@@ -13,7 +13,7 @@ import { BushUser } from './BushUser';
/**
* Represents the logged in client's Discord user.
*/
-export class BushClientUser extends BushUser implements ClientUser {
+export declare class BushClientUser extends BushUser implements ClientUser {
/**
* If the bot's {@link ClientApplication.owner Owner} has MFA enabled on their account
*/
diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts
index 1af3ca1..363c620 100644
--- a/src/lib/extensions/discord.js/BushDMChannel.ts
+++ b/src/lib/extensions/discord.js/BushDMChannel.ts
@@ -1,12 +1,19 @@
+/* eslint-disable deprecation/deprecation */
import type {
- BushBaseGuildVoiceChannel,
+ BushCategoryChannel,
BushClient,
BushMessageManager,
+ BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
BushTextBasedChannel,
+ BushTextChannel,
BushThreadChannel,
- BushUser
+ BushUser,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
} from '#lib';
-import { DMChannel } from 'discord.js';
+import { DMChannel, type Partialize } from 'discord.js';
import type { RawDMChannelData } from 'discord.js/typings/rawDataTypes';
/**
@@ -23,7 +30,18 @@ export class BushDMChannel extends DMChannel {
}
export interface BushDMChannel extends DMChannel {
- isText(): this is BushTextBasedChannel;
- isVoice(): this is BushBaseGuildVoiceChannel;
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
+
+export interface PartialBushDMChannel extends Partialize<BushDMChannel, null, null, 'lastMessageId'> {
+ lastMessageId: undefined;
}
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index 33ee3fc..9f114b6 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -5,6 +5,7 @@ import {
punishmentEntryRemove,
type BanResponse,
type BushClient,
+ type BushGuildChannelManager,
type BushGuildMember,
type BushGuildMemberManager,
type BushGuildMemberResolvable,
@@ -17,7 +18,7 @@ import {
type GuildLogType,
type GuildModel
} from '#lib';
-import { Collection, Guild, Snowflake, type GuildChannelManager, type MessageOptions, type MessagePayload } from 'discord.js';
+import { Collection, Guild, Permissions, Snowflake, type MessageOptions, type MessagePayload } from 'discord.js';
import type { RawGuildData } from 'discord.js/typings/rawDataTypes';
import _ from 'lodash';
import { Moderation } from '../../common/util/Moderation.js';
@@ -33,7 +34,7 @@ export class BushGuild extends Guild {
public declare readonly client: BushClient;
public declare readonly me: BushGuildMember | null;
public declare members: BushGuildMemberManager;
- public declare channels: GuildChannelManager;
+ public declare channels: BushGuildChannelManager;
public constructor(client: BushClient, data: RawGuildData) {
super(client, data);
@@ -133,8 +134,13 @@ export class BushGuild extends Guild {
*/
public async sendLogChannel(logType: GuildLogType, message: string | MessagePayload | MessageOptions) {
const logChannel = await this.getLogChannel(logType);
- if (!logChannel || logChannel.type !== 'GUILD_TEXT') return;
- if (!logChannel.permissionsFor(this.me!.id)?.has(['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS'])) return;
+ if (!logChannel || !logChannel.isTextBased()) return;
+ if (
+ !logChannel
+ .permissionsFor(this.me!.id)
+ ?.has([Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES, Permissions.FLAGS.EMBED_LINKS])
+ )
+ return;
return await logChannel.send(message).catch(() => null);
}
@@ -156,12 +162,13 @@ export class BushGuild extends Guild {
*/
public async bushBan(options: GuildBushBanOptions): Promise<BanResponse> {
// checks
- if (!this.me!.permissions.has('BAN_MEMBERS')) return banResponse.MISSING_PERMISSIONS;
+ if (!this.me!.permissions.has(Permissions.FLAGS.BAN_MEMBERS)) return banResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const user = (await util.resolveNonCachedUser(options.user))!;
- const moderator = client.users.resolve(options.moderator ?? client.user!)!;
+ const user = await util.resolveNonCachedUser(options.user);
+ const moderator = client.users.resolve(options.moderator ?? client.user!);
+ if (!user || !moderator) return banResponse.CANNOT_RESOLVE_USER;
if ((await this.bans.fetch()).has(user.id)) return banResponse.ALREADY_BANNED;
@@ -234,12 +241,13 @@ export class BushGuild extends Guild {
*/
public async bushUnban(options: GuildBushUnbanOptions): Promise<UnbanResponse> {
// checks
- if (!this.me!.permissions.has('BAN_MEMBERS')) return unbanResponse.MISSING_PERMISSIONS;
+ if (!this.me!.permissions.has(Permissions.FLAGS.BAN_MEMBERS)) return unbanResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const user = (await util.resolveNonCachedUser(options.user))!;
- const moderator = client.users.resolve(options.moderator ?? client.user!)!;
+ const user = await util.resolveNonCachedUser(options.user);
+ const moderator = client.users.resolve(options.moderator ?? client.user!);
+ if (!user || !moderator) return unbanResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
const bans = await this.bans.fetch();
@@ -327,11 +335,11 @@ export class BushGuild extends Guild {
success.set(channel.id, false);
continue;
}
- if (!channel.permissionsFor(this.me!.id)?.has(['MANAGE_CHANNELS'])) {
+ if (!channel.permissionsFor(this.me!.id)?.has([Permissions.FLAGS.MANAGE_CHANNELS])) {
errors.set(channel.id, new Error('client no permission'));
success.set(channel.id, false);
continue;
- } else if (!channel.permissionsFor(options.moderator)?.has(['MANAGE_CHANNELS'])) {
+ } else if (!channel.permissionsFor(moderator)?.has([Permissions.FLAGS.MANAGE_CHANNELS])) {
errors.set(channel.id, new Error('moderator no permission'));
success.set(channel.id, false);
continue;
@@ -342,8 +350,12 @@ export class BushGuild extends Guild {
}`;
const permissionOverwrites = channel.isThread() ? channel.parent!.permissionOverwrites : channel.permissionOverwrites;
- const perms = { [channel.isThread() ? 'SEND_MESSAGES_IN_THREADS' : 'SEND_MESSAGES']: options.unlock ? null : false };
- const permsForMe = { [channel.isThread() ? 'SEND_MESSAGES_IN_THREADS' : 'SEND_MESSAGES']: options.unlock ? null : true }; // so I can send messages in the channel
+ const perms = {
+ [channel.isThread() ? 'SEND_MESSAGES_IN_THREADS' : 'FLAGS.SEND_MESSAGES']: options.unlock ? null : false
+ };
+ const permsForMe = {
+ [channel.isThread() ? 'SEND_MESSAGES_IN_THREADS' : 'FLAGS.SEND_MESSAGES']: options.unlock ? null : true
+ }; // so I can send messages in the channel
const changePermSuccess = await permissionOverwrites.edit(this.id, perms, { reason }).catch((e) => e);
if (changePermSuccess instanceof Error) {
@@ -355,7 +367,7 @@ export class BushGuild extends Guild {
await channel.send({
embeds: [
{
- author: { name: moderator.user.tag, iconURL: moderator.displayAvatarURL({ dynamic: true }) },
+ author: { name: moderator.user.tag, iconURL: moderator.displayAvatarURL() },
title: `This channel has been ${options.unlock ? 'un' : ''}locked`,
description: options.reason ?? 'No reason provided',
color: options.unlock ? util.colors.discord.GREEN : util.colors.discord.RED,
diff --git a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts
index 4d76b07..ba9db66 100644
--- a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts
@@ -12,7 +12,11 @@ import type { RawApplicationCommandData } from 'discord.js/typings/rawDataTypes'
/**
* An extension for guild-specific application commands.
*/
-export class BushGuildApplicationCommandManager extends BushApplicationCommandManager<BushApplicationCommand, {}, BushGuild> {
+export declare class BushGuildApplicationCommandManager extends BushApplicationCommandManager<
+ BushApplicationCommand,
+ {},
+ BushGuild
+> {
public constructor(guild: BushGuild, iterable?: Iterable<RawApplicationCommandData>);
public declare readonly client: BushClient;
diff --git a/src/lib/extensions/discord.js/BushGuildBan.d.ts b/src/lib/extensions/discord.js/BushGuildBan.ts
index 11875f3..496e798 100644
--- a/src/lib/extensions/discord.js/BushGuildBan.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildBan.ts
@@ -5,7 +5,7 @@ import type { RawGuildBanData } from 'discord.js/typings/rawDataTypes';
/**
* Represents a ban in a guild on Discord.
*/
-export class BushGuildBan extends GuildBan {
+export declare class BushGuildBan extends GuildBan {
public constructor(client: BushClient, data: RawGuildBanData, guild: BushGuild);
public guild: BushGuild;
public user: BushUser;
diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts
index 6880daf..053507e 100644
--- a/src/lib/extensions/discord.js/BushGuildChannel.ts
+++ b/src/lib/extensions/discord.js/BushGuildChannel.ts
@@ -1,4 +1,19 @@
-import type { BushClient, BushGuild } from '#lib';
+/* eslint-disable deprecation/deprecation */
+import type {
+ BushCategoryChannel,
+ BushClient,
+ BushDMChannel,
+ BushGuild,
+ BushGuildBasedChannel,
+ BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
+ BushTextBasedChannel,
+ BushTextChannel,
+ BushThreadChannel,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
+} from '#lib';
import { GuildChannel } from 'discord.js';
import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
@@ -19,3 +34,16 @@ export class BushGuildChannel extends GuildChannel {
super(guild, data, client, immediatePatch);
}
}
+
+export interface BushGuildChannel extends GuildChannel {
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
+ isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/BushGuildChannelManager.d.ts b/src/lib/extensions/discord.js/BushGuildChannelManager.ts
index 3b07145..dd3885b 100644
--- a/src/lib/extensions/discord.js/BushGuildChannelManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildChannelManager.ts
@@ -1,6 +1,7 @@
import type {
BushFetchedThreads,
BushGuild,
+ BushGuildBasedChannel,
BushMappedGuildChannelTypes,
BushNonThreadGuildBasedChannel,
BushStoreChannel
@@ -10,7 +11,6 @@ import {
type BaseFetchOptions,
type ChannelPosition,
type Collection,
- type GuildBasedChannel,
type GuildChannelCreateOptions,
type GuildChannelManager,
type GuildChannelResolvable,
@@ -22,8 +22,8 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for GuildChannels and stores their cache.
*/
-export class BushGuildChannelManager
- extends CachedManager<Snowflake, GuildBasedChannel, GuildChannelResolvable>
+export declare class BushGuildChannelManager
+ extends CachedManager<Snowflake, BushGuildBasedChannel, GuildChannelResolvable>
implements GuildChannelManager
{
public constructor(guild: BushGuild, iterable?: Iterable<RawGuildChannelData>);
@@ -51,7 +51,7 @@ export class BushGuildChannelManager
* @example
* // Create a new channel with permission overwrites
* guild.channels.create('new-voice', {
- * type: 'GUILD_VOICE',
+ * type: 'GuildVoice',
* permissionOverwrites: [
* {
* id: message.author.id,
@@ -62,7 +62,7 @@ export class BushGuildChannelManager
* @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information
*/
// eslint-disable-next-line deprecation/deprecation
- public create(name: string, options: GuildChannelCreateOptions & { type: 'GUILD_STORE' }): Promise<BushStoreChannel>;
+ public create(name: string, options: GuildChannelCreateOptions & { type: 'GuildStore' }): Promise<BushStoreChannel>;
/**
* Creates a new channel in the guild.
@@ -112,7 +112,7 @@ export class BushGuildChannelManager
/**
* Obtains all active thread channels in the guild from Discord
- * @param cache Whether to cache the fetched data
+ * @param {} [cache=true] Whether to cache the fetched data
* @example
* // Fetch all threads from the guild
* message.guild.channels.fetchActiveThreads()
diff --git a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts
index 9253cad..8b069ae 100644
--- a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts
@@ -1,10 +1,13 @@
import type { BushClient, BushGuild, BushGuildEmoji, BushRole, BushRoleResolvable } from '#lib';
-import { DataManager, type Collection, type Snowflake } from 'discord.js';
+import { DataManager, GuildEmojiRoleManager, type Collection, type Snowflake } from 'discord.js';
/**
* Manages API methods for roles belonging to emojis and stores their cache.
*/
-export class BushGuildEmojiRoleManager extends DataManager<Snowflake, BushRole, BushRoleResolvable> {
+export declare class BushGuildEmojiRoleManager
+ extends DataManager<Snowflake, BushRole, BushRoleResolvable>
+ implements GuildEmojiRoleManager
+{
public constructor(emoji: BushGuildEmoji);
public declare readonly client: BushClient;
diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.ts
index 95719a3..41618e3 100644
--- a/src/lib/extensions/discord.js/BushGuildManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildManager.ts
@@ -1,6 +1,7 @@
import type { BushClient, BushGuild, BushGuildResolvable } from '#lib';
import {
CachedManager,
+ GuildManager,
type Collection,
type FetchGuildOptions,
type FetchGuildsOptions,
@@ -13,7 +14,7 @@ import { type RawGuildData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for Guilds and stores their cache.
*/
-export class BushGuildManager extends CachedManager<Snowflake, BushGuild, BushGuildResolvable> {
+export declare class BushGuildManager extends CachedManager<Snowflake, BushGuild, BushGuildResolvable> implements GuildManager {
public constructor(client: BushClient, iterable?: Iterable<RawGuildData>);
/**
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index 54fb3f0..10d8a4c 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -11,7 +11,7 @@ import {
type BushThreadChannelResolvable,
type BushUser
} from '#lib';
-import { GuildMember, type Partialize, type Role } from 'discord.js';
+import { GuildMember, Permissions, type Partialize, type Role } from 'discord.js';
import type { RawGuildMemberData } from 'discord.js/typings/rawDataTypes';
/* eslint-enable @typescript-eslint/no-unused-vars */
@@ -48,7 +48,8 @@ export class BushGuildMember extends GuildMember {
public async bushWarn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number | null }> {
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return { result: warnResponse.CANNOT_RESOLVE_USER, caseNum: null };
const ret = await (async (): Promise<{ result: WarnResponse; caseNum: number | null }> => {
// add modlog entry
@@ -89,12 +90,13 @@ export class BushGuildMember extends GuildMember {
*/
public async bushAddRole(options: AddRoleOptions): Promise<AddRoleResponse> {
// checks
- if (!this.guild.me!.permissions.has('MANAGE_ROLES')) return addRoleResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return addRoleResponse.MISSING_PERMISSIONS;
const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator);
if (ifShouldAddRole !== true) return ifShouldAddRole;
let caseID: string | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return addRoleResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
if (options.addToModlog || options.duration) {
@@ -159,12 +161,13 @@ export class BushGuildMember extends GuildMember {
*/
public async bushRemoveRole(options: RemoveRoleOptions): Promise<RemoveRoleResponse> {
// checks
- if (!this.guild.me!.permissions.has('MANAGE_ROLES')) return removeRoleResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return removeRoleResponse.MISSING_PERMISSIONS;
const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator);
if (ifShouldAddRole !== true) return ifShouldAddRole;
let caseID: string | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return removeRoleResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
if (options.addToModlog) {
@@ -249,7 +252,7 @@ export class BushGuildMember extends GuildMember {
*/
public async bushMute(options: BushTimedPunishmentOptions): Promise<MuteResponse> {
// checks
- if (!this.guild.me!.permissions.has('MANAGE_ROLES')) return muteResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return muteResponse.MISSING_PERMISSIONS;
const muteRoleID = await this.guild.getSetting('muteRole');
if (!muteRoleID) return muteResponse.NO_MUTE_ROLE;
const muteRole = this.guild.roles.cache.get(muteRoleID);
@@ -259,7 +262,8 @@ export class BushGuildMember extends GuildMember {
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return muteResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// add role
@@ -334,7 +338,7 @@ export class BushGuildMember extends GuildMember {
*/
public async bushUnmute(options: BushPunishmentOptions): Promise<UnmuteResponse> {
// checks
- if (!this.guild.me!.permissions.has('MANAGE_ROLES')) return unmuteResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return unmuteResponse.MISSING_PERMISSIONS;
const muteRoleID = await this.guild.getSetting('muteRole');
if (!muteRoleID) return unmuteResponse.NO_MUTE_ROLE;
const muteRole = this.guild.roles.cache.get(muteRoleID);
@@ -344,7 +348,8 @@ export class BushGuildMember extends GuildMember {
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return unmuteResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// remove role
@@ -416,11 +421,13 @@ export class BushGuildMember extends GuildMember {
*/
public async bushKick(options: BushPunishmentOptions): Promise<KickResponse> {
// checks
- if (!this.guild.me?.permissions.has('KICK_MEMBERS') || !this.kickable) return kickResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me?.permissions.has(Permissions.FLAGS.KICK_MEMBERS) || !this.kickable)
+ return kickResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return kickResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// dm user
const dmSuccess = options.silent ? null : await this.bushPunishDM('kicked', options.reason);
@@ -467,11 +474,12 @@ export class BushGuildMember extends GuildMember {
*/
public async bushBan(options: BushBanOptions): Promise<Exclude<BanResponse, typeof banResponse['ALREADY_BANNED']>> {
// checks
- if (!this.guild.me!.permissions.has('BAN_MEMBERS') || !this.bannable) return banResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.BAN_MEMBERS) || !this.bannable) return banResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return banResponse.CANNOT_RESOLVE_USER;
// ignore result, they should still be banned even if their mute cannot be removed
await this.bushUnmute({
@@ -542,16 +550,16 @@ export class BushGuildMember extends GuildMember {
* @param options Options for blocking the user.
*/
public async bushBlock(options: BlockOptions): Promise<BlockResponse> {
- const _channel = this.guild.channels.resolve(options.channel);
- if (!_channel || (!_channel.isText() && !_channel.isThread())) return blockResponse.INVALID_CHANNEL;
- const channel = _channel as BushGuildTextBasedChannel;
+ const channel = this.guild.channels.resolve(options.channel);
+ if (!channel || (!channel.isTextBased() && !channel.isThread())) return blockResponse.INVALID_CHANNEL;
// checks
- if (!channel.permissionsFor(this.guild.me!)!.has('MANAGE_CHANNELS')) return blockResponse.MISSING_PERMISSIONS;
+ if (!channel.permissionsFor(this.guild.me!)!.has(Permissions.FLAGS.MANAGE_CHANNELS)) return blockResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return blockResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// change channel permissions
@@ -635,11 +643,13 @@ export class BushGuildMember extends GuildMember {
const channel = _channel as BushGuildTextBasedChannel;
// checks
- if (!channel.permissionsFor(this.guild.me!)!.has('MANAGE_CHANNELS')) return unblockResponse.MISSING_PERMISSIONS;
+ if (!channel.permissionsFor(this.guild.me!)!.has(Permissions.FLAGS.MANAGE_CHANNELS))
+ return unblockResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return unblockResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// change channel permissions
@@ -710,14 +720,15 @@ export class BushGuildMember extends GuildMember {
*/
public async bushTimeout(options: BushTimeoutOptions): Promise<TimeoutResponse> {
// checks
- if (!this.guild.me!.permissions.has('MODERATE_MEMBERS')) return timeoutResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS)) return timeoutResponse.MISSING_PERMISSIONS;
const twentyEightDays = client.consts.timeUnits.days.value * 28;
if (options.duration > twentyEightDays) return timeoutResponse.INVALID_DURATION;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return timeoutResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// timeout
@@ -773,11 +784,12 @@ export class BushGuildMember extends GuildMember {
*/
public async bushRemoveTimeout(options: BushPunishmentOptions): Promise<RemoveTimeoutResponse> {
// checks
- if (!this.guild.me!.permissions.has('MODERATE_MEMBERS')) return removeTimeoutResponse.MISSING_PERMISSIONS;
+ if (!this.guild.me!.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS)) return removeTimeoutResponse.MISSING_PERMISSIONS;
let caseID: string | undefined = undefined;
let dmSuccessEvent: boolean | undefined = undefined;
- const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!;
+ const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me);
+ if (!moderator) return removeTimeoutResponse.CANNOT_RESOLVE_USER;
const ret = await (async () => {
// remove timeout
@@ -949,7 +961,8 @@ type ValueOf<T> = T[keyof T];
export const basePunishmentResponse = Object.freeze({
SUCCESS: 'success',
MODLOG_ERROR: 'error creating modlog entry',
- ACTION_ERROR: 'error performing action'
+ ACTION_ERROR: 'error performing action',
+ CANNOT_RESOLVE_USER: 'cannot resolve user'
} as const);
export const dmResponse = Object.freeze({
diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.ts
index a0e65e7..bb130fc 100644
--- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildMemberManager.ts
@@ -1,6 +1,7 @@
import type { BushClient, BushGuild, BushGuildMember, BushGuildMemberResolvable, BushUser, BushUserResolvable } from '#lib';
import {
CachedManager,
+ GuildMemberManager,
type AddGuildMemberOptions,
type BanOptions,
type Collection,
@@ -17,7 +18,10 @@ import type { RawGuildMemberData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for GuildMembers and stores their cache.
*/
-export class BushGuildMemberManager extends CachedManager<Snowflake, BushGuildMember, BushGuildMemberResolvable> {
+export declare class BushGuildMemberManager
+ extends CachedManager<Snowflake, BushGuildMember, BushGuildMemberResolvable>
+ implements GuildMemberManager
+{
public constructor(guild: BushGuild, iterable?: Iterable<RawGuildMemberData>);
public declare readonly client: BushClient;
diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts
index 16c57a2..420f8f5 100644
--- a/src/lib/extensions/discord.js/BushMessage.ts
+++ b/src/lib/extensions/discord.js/BushMessage.ts
@@ -10,10 +10,10 @@ import type {
BushUser
} from '#lib';
import {
+ ActionRowComponent,
Message,
type EmojiIdentifierResolvable,
type If,
- type MessageActionRowComponent,
type MessageEditOptions,
type MessagePayload,
type Partialize,
@@ -55,7 +55,7 @@ export interface BushMessage<Cached extends boolean = boolean> extends Message<C
react(emoji: EmojiIdentifierResolvable): Promise<BushMessageReaction>;
removeAttachments(): Promise<BushMessage>;
reply(options: string | MessagePayload | ReplyMessageOptions): Promise<BushMessage>;
- resolveComponent(customId: string): MessageActionRowComponent | null;
+ resolveComponent(customId: string): ActionRowComponent | null;
startThread(options: StartThreadOptions): Promise<BushThreadChannel>;
suppressEmbeds(suppress?: boolean): Promise<BushMessage>;
unpin(): Promise<BushMessage>;
diff --git a/src/lib/extensions/discord.js/BushMessageManager.d.ts b/src/lib/extensions/discord.js/BushMessageManager.ts
index 84918c0..7ed4199 100644
--- a/src/lib/extensions/discord.js/BushMessageManager.d.ts
+++ b/src/lib/extensions/discord.js/BushMessageManager.ts
@@ -1,6 +1,7 @@
import { BushMessageResolvable, BushTextBasedChannel, type BushMessage } from '#lib';
import {
CachedManager,
+ MessageManager,
type BaseFetchOptions,
type ChannelLogsQueryOptions,
type Collection,
@@ -14,7 +15,10 @@ import type { RawMessageData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for Messages and holds their cache.
*/
-export class BushMessageManager extends CachedManager<Snowflake, BushMessage, BushMessageResolvable> {
+export declare class BushMessageManager
+ extends CachedManager<Snowflake, BushMessage, BushMessageResolvable>
+ implements MessageManager
+{
public constructor(channel: BushTextBasedChannel, iterable?: Iterable<RawMessageData>);
/**
@@ -44,7 +48,7 @@ export class BushMessageManager extends CachedManager<Snowflake, BushMessage, Bu
* @param message The message to edit
* @param options The options to edit the message
*/
- public edit(message: BushMessageResolvable, options: MessagePayload | MessageEditOptions): Promise<BushMessage>;
+ public edit(message: BushMessageResolvable, options: string | MessagePayload | MessageEditOptions): Promise<BushMessage>;
/**
* Gets a message, or messages, from this channel.
@@ -75,7 +79,7 @@ export class BushMessageManager extends CachedManager<Snowflake, BushMessage, Bu
* Fetches the pinned messages of this channel and returns a collection of them.
* <info>The returned Collection does not contain any reaction data of the messages.
* Those need to be fetched separately.</info>
- * @param cache Whether to cache the message(s)
+ * @param {} [cache=true] Whether to cache the message(s)
* @example
* // Get pinned messages
* channel.messages.fetchPinned()
diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts
index cb75076..dbc53e8 100644
--- a/src/lib/extensions/discord.js/BushStoreChannel.ts
+++ b/src/lib/extensions/discord.js/BushStoreChannel.ts
@@ -1,4 +1,19 @@
-import type { BushCategoryChannel, BushClient, BushGuild, BushGuildMember } from '#lib';
+/* eslint-disable deprecation/deprecation */
+import type {
+ BushCategoryChannel,
+ BushClient,
+ BushDMChannel,
+ BushGuild,
+ BushGuildBasedChannel,
+ BushGuildMember,
+ BushNewsChannel,
+ BushStageChannel,
+ BushTextBasedChannel,
+ BushTextChannel,
+ BushThreadChannel,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
+} from '#lib';
import { StoreChannel, type Collection, type Snowflake } from 'discord.js';
import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
@@ -6,7 +21,6 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
* Represents a guild store channel on Discord.
* @deprecated Store channels are deprecated and will be removed from Discord in March 2022. See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information
*/
-// eslint-disable-next-line deprecation/deprecation
export class BushStoreChannel extends StoreChannel {
public declare guild: BushGuild;
public declare readonly members: Collection<Snowflake, BushGuildMember>;
@@ -16,3 +30,16 @@ export class BushStoreChannel extends StoreChannel {
super(guild, data, client);
}
}
+
+export interface BushStoreChannel extends StoreChannel {
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
+ isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts
index 45e1200..15be7bd 100644
--- a/src/lib/extensions/discord.js/BushTextChannel.ts
+++ b/src/lib/extensions/discord.js/BushTextChannel.ts
@@ -1,4 +1,19 @@
-import type { BushGuild, BushMessageManager, BushThreadManager } from '#lib';
+/* eslint-disable deprecation/deprecation */
+import type {
+ BushCategoryChannel,
+ BushDMChannel,
+ BushGuild,
+ BushGuildBasedChannel,
+ BushMessageManager,
+ BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
+ BushTextBasedChannel,
+ BushThreadChannel,
+ BushThreadManager,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
+} from '#lib';
import { TextChannel, type AllowedThreadTypeForTextChannel } from 'discord.js';
import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
@@ -14,3 +29,16 @@ export class BushTextChannel extends TextChannel {
super(guild, data);
}
}
+
+export interface BushTextChannel extends TextChannel {
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
+ isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts
index 3c8859c..a342dd7 100644
--- a/src/lib/extensions/discord.js/BushThreadChannel.ts
+++ b/src/lib/extensions/discord.js/BushThreadChannel.ts
@@ -1,13 +1,20 @@
+/* eslint-disable deprecation/deprecation */
import type {
- BushBaseGuildVoiceChannel,
+ BushCategoryChannel,
BushClient,
+ BushDMChannel,
BushGuild,
+ BushGuildBasedChannel,
BushGuildMember,
BushMessageManager,
BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
BushTextBasedChannel,
BushTextChannel,
- BushThreadMemberManager
+ BushThreadMemberManager,
+ BushVoiceBasedChannel,
+ BushVoiceChannel
} from '#lib';
import { ThreadChannel, type Collection, type Snowflake } from 'discord.js';
import type { RawThreadChannelData } from 'discord.js/typings/rawDataTypes';
@@ -29,7 +36,14 @@ export class BushThreadChannel extends ThreadChannel {
}
export interface BushThreadChannel extends ThreadChannel {
- isText(): this is BushTextBasedChannel;
- isVoice(): this is BushBaseGuildVoiceChannel;
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
}
diff --git a/src/lib/extensions/discord.js/BushThreadManager.d.ts b/src/lib/extensions/discord.js/BushThreadManager.ts
index 6b3340d..b84b98d 100644
--- a/src/lib/extensions/discord.js/BushThreadManager.d.ts
+++ b/src/lib/extensions/discord.js/BushThreadManager.ts
@@ -5,6 +5,7 @@ import {
NewsChannel,
TextChannel,
ThreadChannel,
+ ThreadManager,
type BaseFetchOptions,
type FetchArchivedThreadOptions,
type FetchThreadsOptions,
@@ -17,7 +18,10 @@ import type { RawThreadChannelData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for {@link BushThreadChannel} objects and stores their cache.
*/
-export class BushThreadManager<AllowedThreadType> extends CachedManager<Snowflake, BushThreadChannel, ThreadChannelResolvable> {
+export declare class BushThreadManager<AllowedThreadType>
+ extends CachedManager<Snowflake, BushThreadChannel, ThreadChannelResolvable>
+ implements ThreadManager<AllowedThreadType>
+{
public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>);
/**
@@ -44,7 +48,7 @@ export class BushThreadManager<AllowedThreadType> extends CachedManager<Snowflak
* .create({
* name: 'mod-talk',
* autoArchiveDuration: 60,
- * type: 'GUILD_PRIVATE_THREAD',
+ * type: 'GuildPrivateThread',
* reason: 'Needed a separate thread for moderation',
* })
* .then(threadChannel => console.log(threadChannel))
diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.ts
index dedf102..d597673 100644
--- a/src/lib/extensions/discord.js/BushThreadMemberManager.d.ts
+++ b/src/lib/extensions/discord.js/BushThreadMemberManager.ts
@@ -1,11 +1,21 @@
-import type { BushClient, BushThreadChannel, BushThreadMember, BushThreadMemberResolvable } from '#lib';
-import { CachedManager, type BaseFetchOptions, type Collection, type Snowflake, type UserResolvable } from 'discord.js';
+import type { BushClient, BushThreadChannel, BushThreadMember, BushThreadMemberResolvable, BushUserResolvable } from '#lib';
+import {
+ CachedManager,
+ ThreadMemberManager,
+ type BaseFetchOptions,
+ type Collection,
+ type Snowflake,
+ type UserResolvable
+} from 'discord.js';
import type { RawThreadMemberData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for GuildMembers and stores their cache.
*/
-export class BushThreadMemberManager extends CachedManager<Snowflake, BushThreadMember, BushThreadMemberResolvable> {
+export declare class BushThreadMemberManager
+ extends CachedManager<Snowflake, BushThreadMember, BushThreadMemberResolvable>
+ implements ThreadMemberManager
+{
public constructor(thread: BushThreadChannel, iterable?: Iterable<RawThreadMemberData>);
public declare readonly client: BushClient;
@@ -23,15 +33,10 @@ export class BushThreadMemberManager extends CachedManager<Snowflake, BushThread
/**
* Fetches member(s) for the thread from Discord, requires access to the `GUILD_MEMBERS` gateway intent.
- * @param member The member to fetch. If `undefined`, all members in the thread are fetched, and will be
- * cached based on `options.cache`. If boolean, this serves the purpose of `options.cache`.
- * @param options Additional options for this fetch
- */
- public fetch(member?: UserResolvable, options?: BaseFetchOptions): Promise<BushThreadMember>;
-
- /**
- * @deprecated Use `fetch(member, options)` instead.
+ * @param options Additional options for this fetch, when a `boolean` is provided
+ * all members are fetched with `options.cache` set to the boolean value
*/
+ public fetch(options?: BushThreadMemberFetchOptions): Promise<BushThreadMember>;
public fetch(cache?: boolean): Promise<Collection<Snowflake, BushThreadMember>>;
/**
@@ -41,3 +46,10 @@ export class BushThreadMemberManager extends CachedManager<Snowflake, BushThread
*/
public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>;
}
+
+export interface BushThreadMemberFetchOptions extends BaseFetchOptions {
+ /**
+ * The specific user to fetch from the thread
+ */
+ member?: BushUserResolvable;
+}
diff --git a/src/lib/extensions/discord.js/BushUserManager.d.ts b/src/lib/extensions/discord.js/BushUserManager.ts
index 5d814da..ae28f1d 100644
--- a/src/lib/extensions/discord.js/BushUserManager.d.ts
+++ b/src/lib/extensions/discord.js/BushUserManager.ts
@@ -5,6 +5,7 @@ import {
MessageOptions,
MessagePayload,
UserFlags,
+ UserManager,
type BaseFetchOptions,
type Snowflake
} from 'discord.js';
@@ -13,7 +14,7 @@ import type { RawUserData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for users and stores their cache.
*/
-export class BushUserManager extends CachedManager<Snowflake, BushUser, BushUserResolvable> {
+export declare class BushUserManager extends CachedManager<Snowflake, BushUser, BushUserResolvable> implements UserManager {
private constructor(client: BushClient, iterable?: Iterable<RawUserData>);
/**
@@ -24,14 +25,14 @@ export class BushUserManager extends CachedManager<Snowflake, BushUser, BushUser
public dmChannel(userId: Snowflake): BushDMChannel | null;
/**
- * Creates a {@link DMChannel} between the client and a user.
+ * Creates a {@link BushDMChannel} between the client and a user.
* @param user The UserResolvable to identify
* @param options Additional options for this fetch
*/
public createDM(user: BushUserResolvable, options?: BaseFetchOptions): Promise<BushDMChannel>;
/**
- * Deletes a {@link DMChannel} (if one exists) between the client and a user. Resolves with the channel if successful.
+ * Deletes a {@link BushDMChannel} (if one exists) between the client and a user. Resolves with the channel if successful.
* @param user The UserResolvable to identify
*/
public deleteDM(user: BushUserResolvable): Promise<BushDMChannel>;
diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts
index 9f246e5..a0ee47d 100644
--- a/src/lib/extensions/discord.js/BushVoiceChannel.ts
+++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts
@@ -1,4 +1,19 @@
-import type { BushClient, BushGuild, BushGuildMember } from '#lib';
+/* eslint-disable deprecation/deprecation */
+import type {
+ BushCategoryChannel,
+ BushClient,
+ BushDMChannel,
+ BushGuild,
+ BushGuildBasedChannel,
+ BushGuildMember,
+ BushNewsChannel,
+ BushStageChannel,
+ BushStoreChannel,
+ BushTextBasedChannel,
+ BushTextChannel,
+ BushThreadChannel,
+ BushVoiceBasedChannel
+} from '#lib';
import { VoiceChannel, type Collection, type Snowflake } from 'discord.js';
import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes';
@@ -13,3 +28,16 @@ export class BushVoiceChannel extends VoiceChannel {
super(guild, data);
}
}
+
+export interface BushVoiceChannel extends VoiceChannel {
+ isText(): this is BushTextChannel;
+ isDM(): this is BushDMChannel;
+ isVoice(): this is BushVoiceChannel;
+ isCategory(): this is BushCategoryChannel;
+ isNews(): this is BushNewsChannel;
+ isStore(): this is BushStoreChannel;
+ isThread(): this is BushThreadChannel;
+ isStage(): this is BushStageChannel;
+ isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel;
+ isVoiceBased(): this is BushVoiceBasedChannel;
+}
diff --git a/src/lib/extensions/discord.js/other.ts b/src/lib/extensions/discord.js/other.ts
index f81e01c..784442d 100644
--- a/src/lib/extensions/discord.js/other.ts
+++ b/src/lib/extensions/discord.js/other.ts
@@ -1,3 +1,4 @@
+/* eslint-disable deprecation/deprecation */
import type {
BushApplicationCommand,
BushCategoryChannel,
@@ -15,10 +16,10 @@ import type {
BushThreadChannel,
BushThreadMember,
BushUser,
- BushVoiceChannel
+ BushVoiceChannel,
+ PartialBushDMChannel
} from '#lib';
-import type { Collection, EnumValueMapped, Message, PartialDMChannel, Snowflake } from 'discord.js';
-import type { ChannelTypes } from 'discord.js/typings/enums';
+import type { ChannelType, Collection, Message, Snowflake } from 'discord.js';
/**
* Data that resolves to give a ThreadMember object.
@@ -86,10 +87,9 @@ export type BushGuildChannelResolvable = Snowflake | BushGuildBasedChannel;
export type BushAnyChannel =
| BushCategoryChannel
| BushDMChannel
- | PartialDMChannel
+ | PartialBushDMChannel
| BushNewsChannel
| BushStageChannel
- // eslint-disable-next-line deprecation/deprecation
| BushStoreChannel
| BushTextChannel
| BushThreadChannel
@@ -98,7 +98,7 @@ export type BushAnyChannel =
/**
* The channels that are text-based.
*/
-export type BushTextBasedChannel = PartialDMChannel | BushThreadChannel | BushDMChannel | BushNewsChannel | BushTextChannel;
+export type BushTextBasedChannel = PartialBushDMChannel | BushThreadChannel | BushDMChannel | BushNewsChannel | BushTextChannel;
/**
* The types of channels that are text-based.
@@ -123,25 +123,17 @@ export type BushTextChannelResolvable = Snowflake | BushTextChannel;
*/
export type BushGuildVoiceChannelResolvable = BushVoiceBasedChannel | Snowflake;
-export type BushMappedChannelCategoryTypes = EnumValueMapped<
- typeof ChannelTypes,
- {
- GUILD_NEWS: BushNewsChannel;
- GUILD_VOICE: BushVoiceChannel;
- GUILD_TEXT: BushTextChannel;
- // eslint-disable-next-line deprecation/deprecation
- GUILD_STORE: BushStoreChannel;
- GUILD_STAGE_VOICE: BushStageChannel;
- }
->;
-
-export type BushMappedGuildChannelTypes = EnumValueMapped<
- typeof ChannelTypes,
- {
- GUILD_CATEGORY: BushCategoryChannel;
- }
-> &
- BushMappedChannelCategoryTypes;
+export interface BushMappedChannelCategoryTypes {
+ [ChannelType.GuildNews]: BushNewsChannel;
+ [ChannelType.GuildVoice]: BushVoiceChannel;
+ [ChannelType.GuildText]: BushTextChannel;
+ [ChannelType.GuildStore]: BushStoreChannel;
+ [ChannelType.GuildStageVoice]: BushStageChannel;
+}
+
+export type BushMappedGuildChannelTypes = {
+ [ChannelType.GuildCategory]: BushCategoryChannel;
+} & BushMappedChannelCategoryTypes;
/**
* The data returned from a thread fetch that returns multiple threads.
@@ -157,3 +149,15 @@ export interface BushFetchedThreads {
*/
hasMore?: boolean;
}
+
+// for reverse key mapping
+
+/**
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
+ */
+export enum BushInteractionType {
+ Ping = 1,
+ ApplicationCommand = 2,
+ MessageComponent = 3,
+ ApplicationCommandAutocomplete = 4
+}