fix: more client eris mismatches

This commit is contained in:
Skillz
2023-03-02 10:48:47 -06:00
parent 898578f349
commit fc13bdf3c3
5 changed files with 609 additions and 573 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,20 +4,21 @@
import {
MessageTypes,
type DiscordEmbed,
type DiscordMessageActivity,
type DiscordStickerItem,
type DiscordApplication,
type DiscordAttachment,
type DiscordEmbed,
type DiscordMemberWithUser,
type DiscordMessage,
type DiscordMessageActivity,
type DiscordMessageComponents,
type DiscordStickerItem,
type InteractionTypes,
} from '@discordeno/types'
import Base from '../Base.js'
import type Client from '../Client.js'
import { MessageFlags } from '../Constants.js'
import { MESSAGE_LINK } from '../Endpoints.js'
import { MessageFlags, type GetMessageReactionOptions, type MessageContentEdit, type MessageWebhookContent } from '../typings.js'
import type { GetMessageReactionOptions, MessageContentEdit, MessageWebhookContent } from '../typings.js'
import type NewsChannel from './channels/News.js'
import type PrivateChannel from './channels/Private.js'
import type TextChannel from './channels/Text.js'

View File

@@ -18,6 +18,8 @@ export class GuildChannel extends Channel {
guild: Guild
nsfw: boolean
permissionOverwrites = new Collection<BigString, PermissionOverwrite>()
/** The RTC region ID of the channel (automatic if `null`) (guild voice channels only) */
rtcRegion: string | null = null
constructor(data: DiscordChannel, client: Client) {
super(data, client)

View File

@@ -13,6 +13,7 @@ import type {
GetMessageReactionOptions,
ListedChannelThreads,
MessageContent,
MessageContentEdit,
PurgeChannelOptions,
} from '../../typings.js'
import type Invite from '../Invite.js'
@@ -204,7 +205,7 @@ export class TextChannel extends GuildChannel {
* @arg {Number} [content.flags] A number representing the flags to apply to the message. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#message-object-message-flags) for flags reference
* @returns {Promise<Message>}
*/
async editMessage(messageID: string, content: string) {
async editMessage(messageID: string, content: MessageContentEdit) {
return this.client.editMessage.call(this.client, this.id, messageID, content)
}

View File

@@ -18,9 +18,9 @@ import type {
VideoQualityModes,
WebhookTypes,
} from '@discordeno/types'
import type { IncomingHttpHeaders } from 'node:http'
import type Collection from './Collection.js'
import type Message from './Structures/Message.js'
import type Permission from './Structures/Permission.js'
import type { Guild, Invite } from './index.js'
import type CategoryChannel from './Structures/channels/Category.js'
import type NewsChannel from './Structures/channels/News.js'
import type PrivateChannel from './Structures/channels/Private.js'
@@ -35,8 +35,6 @@ import type ThreadChannel from './Structures/channels/threads/Thread.js'
import type GuildAuditLogEntry from './Structures/guilds/AuditLogEntry.js'
import type GuildIntegration from './Structures/guilds/Integration.js'
import type Member from './Structures/guilds/Member.js'
import type User from './Structures/users/User.js'
import type { Guild, Invite } from './index.js'
import type Role from './Structures/guilds/Role.js'
import type StageInstance from './Structures/guilds/StageInstance.js'
import type UnavailableGuild from './Structures/guilds/Unavailable.js'
@@ -45,7 +43,9 @@ import type CommandInteraction from './Structures/interactions/Command.js'
import type ComponentInteraction from './Structures/interactions/Component.js'
import type PingInteraction from './Structures/interactions/Ping.js'
import type UnknownInteraction from './Structures/interactions/Unknown.js'
import type { IncomingHttpHeaders } from 'node:http'
import type Message from './Structures/Message.js'
import type Permission from './Structures/Permission.js'
import type User from './Structures/users/User.js'
export type ApplicationCommandStructure = ChatInputApplicationCommandStructure | MessageApplicationCommandStructure | UserApplicationCommandStructure
export type ChatInputApplicationCommand = ApplicationCommand<ApplicationCommandTypes.ChatInput>
@@ -475,7 +475,7 @@ export interface GuildOptions {
description?: string
discoverySplash?: string
explicitContentFilter?: ExplicitContentFilterLevels
features?: GuildFeatures[]
features?: GuildFeatures[]
icon?: string
name?: string
ownerID?: string
@@ -884,125 +884,129 @@ export enum InviteTargetTypes {
STREAM = 1,
EMBEDDED_APPLICATION,
}
export const MessageFlags = {
CROSSPOSTED: 1,
IS_CROSSPOST: 2,
SUPPRESS_EMBEDS: 4,
SOURCE_MESSAGE_DELETED: 8,
URGENT: 16,
HAS_THREAD: 32,
EPHEMERAL: 64,
LOADING: 128,
}
export interface EventListeners {
channelCreate: [channel: AnyGuildChannel];
channelDelete: [channel: AnyChannel];
channelPinUpdate: [channel: TextableChannel, timestamp: number, oldTimestamp: number];
channelUpdate: [channel: AnyGuildChannel, oldChannel: any];
connect: [id: number];
debug: [message: string, id?: number];
disconnect: [];
error: [err: Error, id?: number];
guildAvailable: [guild: Guild];
guildBanAdd: [guild: Guild, user: User];
guildBanRemove: [guild: Guild, user: User];
guildCreate: [guild: Guild];
guildDelete: [guild: any];
guildEmojisUpdate: [guild: any, emojis: Emoji[], oldEmojis: Emoji[] | null];
guildMemberAdd: [guild: Guild, member: Member];
guildMemberChunk: [guild: Guild, member: Member[]];
guildMemberRemove: [guild: Guild, member: Member | any];
guildMemberUpdate: [guild: Guild, member: Member, oldMember: any | null];
guildRoleCreate: [guild: Guild, role: Role];
guildRoleDelete: [guild: Guild, role: Role];
guildRoleUpdate: [guild: Guild, role: Role, oldRole: any];
guildScheduledEventCreate: [event: any];
guildScheduledEventDelete: [event: any];
guildScheduledEventUpdate: [event: any, oldEvent: any | null];
guildScheduledEventUserAdd: [event: any, user: User | Uncached];
guildScheduledEventUserRemove: [event: any, user: User | Uncached];
guildStickersUpdate: [guild: any, stickers: Sticker[], oldStickers: Sticker[] | null];
guildUnavailable: [guild: UnavailableGuild];
guildUpdate: [guild: Guild, oldGuild: any];
hello: [trace: string[], id: number];
interactionCreate: [interaction: PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction | UnknownInteraction];
inviteCreate: [guild: Guild, invite: Invite];
inviteDelete: [guild: Guild, invite: Invite];
messageCreate: [message: Message];
messageDelete: [message: any];
messageDeleteBulk: [messages: any[]];
messageReactionAdd: [message: any, emoji: PartialEmoji, reactor: Member | Uncached];
messageReactionRemove: [message: any, emoji: PartialEmoji, userID: string];
messageReactionRemoveAll: [message: any];
messageReactionRemoveEmoji: [message: any, emoji: PartialEmoji];
messageUpdate: [message: Message, oldMessage: any | null];
presenceUpdate: [other: Member, oldPresence: any | null];
rawREST: [request: any];
rawWS: [packet: any, id: number];
ready: [];
shardPreReady: [id: number];
stageInstanceCreate: [stageInstance: StageInstance];
stageInstanceDelete: [stageInstance: StageInstance];
stageInstanceUpdate: [stageInstance: StageInstance, oldStageInstance: any | null];
threadCreate: [channel: AnyThreadChannel];
threadDelete: [channel: AnyThreadChannel];
threadListSync: [guild: Guild, deletedThreads: Array<AnyThreadChannel | Uncached>, activeThreads: AnyThreadChannel[], joinedThreadsMember: ThreadMember[]];
threadMembersUpdate: [channel: AnyThreadChannel, addedMembers: ThreadMember[], removedMembers: Array<ThreadMember | Uncached>];
threadMemberUpdate: [channel: AnyThreadChannel, member: ThreadMember, oldMember: any];
threadUpdate: [channel: AnyThreadChannel, oldChannel: any | null];
typingStart: [channel: GuildTextableChannel | Uncached, user: User | Uncached, member: Member]
| [channel: PrivateChannel | Uncached, user: User | Uncached, member: null];
unavailableGuildCreate: [guild: UnavailableGuild];
unknown: [packet: any, id?: number];
userUpdate: [user: User, oldUser: PartialUser | null];
voiceChannelJoin: [member: Member, channel: AnyVoiceChannel];
voiceChannelLeave: [member: Member, channel: AnyVoiceChannel];
voiceChannelSwitch: [member: Member, newChannel: AnyVoiceChannel, oldChannel: AnyVoiceChannel];
voiceStateUpdate: [member: Member, oldState: any];
warn: [message: string, id?: number];
webhooksUpdate: [data: any];
channelCreate: [channel: AnyGuildChannel]
channelDelete: [channel: AnyChannel]
channelPinUpdate: [channel: TextableChannel, timestamp: number, oldTimestamp: number]
channelUpdate: [channel: AnyGuildChannel, oldChannel: any]
connect: [id: number]
debug: [message: string, id?: number]
disconnect: []
error: [err: Error, id?: number]
guildAvailable: [guild: Guild]
guildBanAdd: [guild: Guild, user: User]
guildBanRemove: [guild: Guild, user: User]
guildCreate: [guild: Guild]
guildDelete: [guild: any]
guildEmojisUpdate: [guild: any, emojis: Emoji[], oldEmojis: Emoji[] | null]
guildMemberAdd: [guild: Guild, member: Member]
guildMemberChunk: [guild: Guild, member: Member[]]
guildMemberRemove: [guild: Guild, member: Member | any]
guildMemberUpdate: [guild: Guild, member: Member, oldMember: any | null]
guildRoleCreate: [guild: Guild, role: Role]
guildRoleDelete: [guild: Guild, role: Role]
guildRoleUpdate: [guild: Guild, role: Role, oldRole: any]
guildScheduledEventCreate: [event: any]
guildScheduledEventDelete: [event: any]
guildScheduledEventUpdate: [event: any, oldEvent: any | null]
guildScheduledEventUserAdd: [event: any, user: User | Uncached]
guildScheduledEventUserRemove: [event: any, user: User | Uncached]
guildStickersUpdate: [guild: any, stickers: Sticker[], oldStickers: Sticker[] | null]
guildUnavailable: [guild: UnavailableGuild]
guildUpdate: [guild: Guild, oldGuild: any]
hello: [trace: string[], id: number]
interactionCreate: [interaction: PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction | UnknownInteraction]
inviteCreate: [guild: Guild, invite: Invite]
inviteDelete: [guild: Guild, invite: Invite]
messageCreate: [message: Message]
messageDelete: [message: any]
messageDeleteBulk: [messages: any[]]
messageReactionAdd: [message: any, emoji: PartialEmoji, reactor: Member | Uncached]
messageReactionRemove: [message: any, emoji: PartialEmoji, userID: string]
messageReactionRemoveAll: [message: any]
messageReactionRemoveEmoji: [message: any, emoji: PartialEmoji]
messageUpdate: [message: Message, oldMessage: any | null]
presenceUpdate: [other: Member, oldPresence: any | null]
rawREST: [request: any]
rawWS: [packet: any, id: number]
ready: []
shardPreReady: [id: number]
stageInstanceCreate: [stageInstance: StageInstance]
stageInstanceDelete: [stageInstance: StageInstance]
stageInstanceUpdate: [stageInstance: StageInstance, oldStageInstance: any | null]
threadCreate: [channel: AnyThreadChannel]
threadDelete: [channel: AnyThreadChannel]
threadListSync: [
guild: Guild,
deletedThreads: Array<AnyThreadChannel | Uncached>,
activeThreads: AnyThreadChannel[],
joinedThreadsMember: ThreadMember[],
]
threadMembersUpdate: [channel: AnyThreadChannel, addedMembers: ThreadMember[], removedMembers: Array<ThreadMember | Uncached>]
threadMemberUpdate: [channel: AnyThreadChannel, member: ThreadMember, oldMember: any]
threadUpdate: [channel: AnyThreadChannel, oldChannel: any | null]
typingStart:
| [channel: GuildTextableChannel | Uncached, user: User | Uncached, member: Member]
| [channel: PrivateChannel | Uncached, user: User | Uncached, member: null]
unavailableGuildCreate: [guild: UnavailableGuild]
unknown: [packet: any, id?: number]
userUpdate: [user: User, oldUser: PartialUser | null]
voiceChannelJoin: [member: Member, channel: AnyVoiceChannel]
voiceChannelLeave: [member: Member, channel: AnyVoiceChannel]
voiceChannelSwitch: [member: Member, newChannel: AnyVoiceChannel, oldChannel: AnyVoiceChannel]
voiceStateUpdate: [member: Member, oldState: any]
warn: [message: string, id?: number]
webhooksUpdate: [data: any]
}
export interface ClientEvents extends EventListeners {
shardDisconnect: [err: Error | undefined, id: number];
shardReady: [id: number];
shardResume: [id: number];
shardDisconnect: [err: Error | undefined, id: number]
shardReady: [id: number]
shardResume: [id: number]
}
export interface HTTPResponse {
code: number;
message: string;
code: number
message: string
errors?: HTTPResponse
headers: IncomingHttpHeaders
}
export type AnyInteraction = PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction;
export type InteractionDataOptions = InteractionDataOptionsSubCommand | InteractionDataOptionsSubCommandGroup | InteractionDataOptionsWithValue;
export type InteractionDataOptionsBoolean = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Boolean, boolean>;
export type InteractionDataOptionsChannel = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Channel, string>;
export type InteractionDataOptionsInteger = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Integer, number>;
export type InteractionDataOptionsMentionable = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Mentionable, string>;
export type InteractionDataOptionsNumber = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Number, number>;
export type InteractionDataOptionsRole = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Role, string>;
export type InteractionDataOptionsString = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.String, string>;
export type InteractionDataOptionsUser = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.User, string>;
export type InteractionDataOptionsWithValue = InteractionDataOptionsString | InteractionDataOptionsInteger | InteractionDataOptionsBoolean | InteractionDataOptionsUser | InteractionDataOptionsChannel | InteractionDataOptionsRole | InteractionDataOptionsMentionable | InteractionDataOptionsNumber;
export type AnyInteraction = PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction
export type InteractionDataOptions = InteractionDataOptionsSubCommand | InteractionDataOptionsSubCommandGroup | InteractionDataOptionsWithValue
export type InteractionDataOptionsBoolean = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Boolean, boolean>
export type InteractionDataOptionsChannel = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Channel, string>
export type InteractionDataOptionsInteger = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Integer, number>
export type InteractionDataOptionsMentionable = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Mentionable, string>
export type InteractionDataOptionsNumber = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Number, number>
export type InteractionDataOptionsRole = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.Role, string>
export type InteractionDataOptionsString = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.String, string>
export type InteractionDataOptionsUser = InteractionDataOptionWithValue<ApplicationCommandOptionTypes.User, string>
export type InteractionDataOptionsWithValue =
| InteractionDataOptionsString
| InteractionDataOptionsInteger
| InteractionDataOptionsBoolean
| InteractionDataOptionsUser
| InteractionDataOptionsChannel
| InteractionDataOptionsRole
| InteractionDataOptionsMentionable
| InteractionDataOptionsNumber
export interface InteractionDataOptionWithValue<T extends ApplicationCommandOptionTypes, V = unknown> {
focused?: boolean;
name: string;
type: T;
value: V;
focused?: boolean
name: string
type: T
value: V
}
export interface InteractionDataOptionsSubCommand {
name: string;
options?: InteractionDataOptions[];
type: ApplicationCommandOptionTypes.SubCommand;
name: string
options?: InteractionDataOptions[]
type: ApplicationCommandOptionTypes.SubCommand
}
export interface InteractionDataOptionsSubCommandGroup {
name: string;
options: InteractionDataOptions[];
type: ApplicationCommandOptionTypes.SubCommandGroup;
name: string
options: InteractionDataOptions[]
type: ApplicationCommandOptionTypes.SubCommandGroup
}