mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat(VoiceChannel): add support for text in voice (#6921)
This commit is contained in:
@@ -10,7 +10,7 @@ class WebhooksUpdate extends Action {
|
|||||||
/**
|
/**
|
||||||
* Emitted whenever a channel has its webhooks changed.
|
* Emitted whenever a channel has its webhooks changed.
|
||||||
* @event Client#webhookUpdate
|
* @event Client#webhookUpdate
|
||||||
* @param {TextChannel|NewsChannel} channel The channel that had a webhook update
|
* @param {TextChannel|NewsChannel|VoiceChannel} channel The channel that had a webhook update
|
||||||
*/
|
*/
|
||||||
if (channel) client.emit(Events.WebhooksUpdate, channel);
|
if (channel) client.emit(Events.WebhooksUpdate, channel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,44 +109,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
return this.edit({ type }, reason);
|
return this.edit({ type }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches all webhooks for the channel.
|
|
||||||
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
|
||||||
* @example
|
|
||||||
* // Fetch webhooks
|
|
||||||
* channel.fetchWebhooks()
|
|
||||||
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
|
||||||
* .catch(console.error);
|
|
||||||
*/
|
|
||||||
fetchWebhooks() {
|
|
||||||
return this.guild.channels.fetchWebhooks(this.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options used to create a {@link Webhook} in a {@link TextChannel} or a {@link NewsChannel}.
|
|
||||||
* @typedef {Object} ChannelWebhookCreateOptions
|
|
||||||
* @property {?(BufferResolvable|Base64Resolvable)} [avatar] Avatar for the webhook
|
|
||||||
* @property {string} [reason] Reason for creating the webhook
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a webhook for the channel.
|
|
||||||
* @param {string} name The name of the webhook
|
|
||||||
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
|
||||||
* @returns {Promise<Webhook>} Returns the created Webhook
|
|
||||||
* @example
|
|
||||||
* // Create a webhook for the current channel
|
|
||||||
* channel.createWebhook('Snek', {
|
|
||||||
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
|
||||||
* reason: 'Needed a cool new Webhook'
|
|
||||||
* })
|
|
||||||
* .then(console.log)
|
|
||||||
* .catch(console.error)
|
|
||||||
*/
|
|
||||||
createWebhook(name, options = {}) {
|
|
||||||
return this.guild.channels.createWebhook(this.id, name, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new topic for the guild channel.
|
* Sets a new topic for the guild channel.
|
||||||
* @param {?string} topic The new topic for the guild channel
|
* @param {?string} topic The new topic for the guild channel
|
||||||
@@ -222,6 +184,8 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
createMessageComponentCollector() {}
|
createMessageComponentCollector() {}
|
||||||
awaitMessageComponent() {}
|
awaitMessageComponent() {}
|
||||||
bulkDelete() {}
|
bulkDelete() {}
|
||||||
|
fetchWebhooks() {}
|
||||||
|
createWebhook() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
||||||
|
|||||||
@@ -112,8 +112,10 @@ class DMChannel extends Channel {
|
|||||||
createMessageComponentCollector() {}
|
createMessageComponentCollector() {}
|
||||||
awaitMessageComponent() {}
|
awaitMessageComponent() {}
|
||||||
// Doesn't work on DM channels; bulkDelete() {}
|
// Doesn't work on DM channels; bulkDelete() {}
|
||||||
|
// Doesn't work on DM channels; fetchWebhooks() {}
|
||||||
|
// Doesn't work on DM channels; createWebhook() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);
|
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete', 'fetchWebhooks', 'createWebhook']);
|
||||||
|
|
||||||
module.exports = DMChannel;
|
module.exports = DMChannel;
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ class Message extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel that the message was sent in
|
* The channel that the message was sent in
|
||||||
* @type {TextChannel|DMChannel|NewsChannel|ThreadChannel}
|
* @type {TextBasedChannel}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get channel() {
|
get channel() {
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ module.exports = MessagePayload;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A target for a message.
|
* A target for a message.
|
||||||
* @typedef {TextChannel|DMChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
|
* @typedef {TextBasedChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
|
||||||
* Message|MessageManager} MessageTarget
|
* Message|MessageManager} MessageTarget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,26 @@
|
|||||||
|
|
||||||
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
||||||
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
|
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
|
||||||
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||||
|
const MessageManager = require('../managers/MessageManager');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a guild voice channel on Discord.
|
* Represents a guild voice channel on Discord.
|
||||||
* @extends {BaseGuildVoiceChannel}
|
* @extends {BaseGuildVoiceChannel}
|
||||||
*/
|
*/
|
||||||
class VoiceChannel extends BaseGuildVoiceChannel {
|
class VoiceChannel extends BaseGuildVoiceChannel {
|
||||||
|
constructor(guild, data, client) {
|
||||||
|
super(guild, data, client, false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A manager of the messages sent to this channel
|
||||||
|
* @type {MessageManager}
|
||||||
|
*/
|
||||||
|
this.messages = new MessageManager(this);
|
||||||
|
|
||||||
|
this._patch(data);
|
||||||
|
}
|
||||||
|
|
||||||
_patch(data) {
|
_patch(data) {
|
||||||
super._patch(data);
|
super._patch(data);
|
||||||
|
|
||||||
@@ -20,6 +34,18 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
} else {
|
} else {
|
||||||
this.videoQualityMode ??= null;
|
this.videoQualityMode ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('last_message_id' in data) {
|
||||||
|
/**
|
||||||
|
* The last message id sent in the channel, if one was sent
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.lastMessageId = data.last_message_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('messages' in data) {
|
||||||
|
for (const message of data.messages) this.messages._add(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,6 +116,19 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
return this.edit({ videoQualityMode }, reason);
|
return this.edit({ videoQualityMode }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||||
|
/* eslint-disable no-empty-function */
|
||||||
|
get lastMessage() {}
|
||||||
|
send() {}
|
||||||
|
sendTyping() {}
|
||||||
|
createMessageCollector() {}
|
||||||
|
awaitMessages() {}
|
||||||
|
createMessageComponentCollector() {}
|
||||||
|
awaitMessageComponent() {}
|
||||||
|
bulkDelete() {}
|
||||||
|
fetchWebhooks() {}
|
||||||
|
createWebhook() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RTC region of the channel.
|
* Sets the RTC region of the channel.
|
||||||
* @name VoiceChannel#setRTCRegion
|
* @name VoiceChannel#setRTCRegion
|
||||||
@@ -105,4 +144,6 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextBasedChannel.applyToClass(VoiceChannel, true, ['lastPinAt']);
|
||||||
|
|
||||||
module.exports = VoiceChannel;
|
module.exports = VoiceChannel;
|
||||||
|
|||||||
@@ -329,6 +329,44 @@ class TextBasedChannel {
|
|||||||
throw new TypeError('MESSAGE_BULK_DELETE_TYPE');
|
throw new TypeError('MESSAGE_BULK_DELETE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches all webhooks for the channel.
|
||||||
|
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
||||||
|
* @example
|
||||||
|
* // Fetch webhooks
|
||||||
|
* channel.fetchWebhooks()
|
||||||
|
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
fetchWebhooks() {
|
||||||
|
return this.guild.channels.fetchWebhooks(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options used to create a {@link Webhook} in a {@link TextChannel} or a {@link NewsChannel}.
|
||||||
|
* @typedef {Object} ChannelWebhookCreateOptions
|
||||||
|
* @property {?(BufferResolvable|Base64Resolvable)} [avatar] Avatar for the webhook
|
||||||
|
* @property {string} [reason] Reason for creating the webhook
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a webhook for the channel.
|
||||||
|
* @param {string} name The name of the webhook
|
||||||
|
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
||||||
|
* @returns {Promise<Webhook>} Returns the created Webhook
|
||||||
|
* @example
|
||||||
|
* // Create a webhook for the current channel
|
||||||
|
* channel.createWebhook('Snek', {
|
||||||
|
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
||||||
|
* reason: 'Needed a cool new Webhook'
|
||||||
|
* })
|
||||||
|
* .then(console.log)
|
||||||
|
* .catch(console.error)
|
||||||
|
*/
|
||||||
|
createWebhook(name, options = {}) {
|
||||||
|
return this.guild.channels.createWebhook(this.id, name, options);
|
||||||
|
}
|
||||||
|
|
||||||
static applyToClass(structure, full = false, ignore = []) {
|
static applyToClass(structure, full = false, ignore = []) {
|
||||||
const props = ['send'];
|
const props = ['send'];
|
||||||
if (full) {
|
if (full) {
|
||||||
@@ -341,6 +379,8 @@ class TextBasedChannel {
|
|||||||
'awaitMessages',
|
'awaitMessages',
|
||||||
'createMessageComponentCollector',
|
'createMessageComponentCollector',
|
||||||
'awaitMessageComponent',
|
'awaitMessageComponent',
|
||||||
|
'fetchWebhooks',
|
||||||
|
'createWebhook',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const prop of props) {
|
for (const prop of props) {
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ exports.NonSystemMessageTypes = [
|
|||||||
* * TextChannel
|
* * TextChannel
|
||||||
* * NewsChannel
|
* * NewsChannel
|
||||||
* * ThreadChannel
|
* * ThreadChannel
|
||||||
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel} TextBasedChannels
|
* * VoiceChannel
|
||||||
|
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel|VoiceChannel} TextBasedChannels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +81,7 @@ exports.NonSystemMessageTypes = [
|
|||||||
* * {@link ChannelType.GuildNewsThread}
|
* * {@link ChannelType.GuildNewsThread}
|
||||||
* * {@link ChannelType.GuildPublicThread}
|
* * {@link ChannelType.GuildPublicThread}
|
||||||
* * {@link ChannelType.GuildPrivateThread}
|
* * {@link ChannelType.GuildPrivateThread}
|
||||||
|
* * {@link ChannelType.GuildVoice}
|
||||||
* @typedef {ChannelType} TextBasedChannelTypes
|
* @typedef {ChannelType} TextBasedChannelTypes
|
||||||
*/
|
*/
|
||||||
exports.TextBasedChannelTypes = [
|
exports.TextBasedChannelTypes = [
|
||||||
@@ -89,6 +91,7 @@ exports.TextBasedChannelTypes = [
|
|||||||
ChannelType.GuildNewsThread,
|
ChannelType.GuildNewsThread,
|
||||||
ChannelType.GuildPublicThread,
|
ChannelType.GuildPublicThread,
|
||||||
ChannelType.GuildPrivateThread,
|
ChannelType.GuildPrivateThread,
|
||||||
|
ChannelType.GuildVoice,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
18
packages/discord.js/typings/index.d.ts
vendored
18
packages/discord.js/typings/index.d.ts
vendored
@@ -494,12 +494,10 @@ export class BaseGuildEmoji extends Emoji {
|
|||||||
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
||||||
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
|
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
|
||||||
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||||
public messages: MessageManager;
|
|
||||||
public nsfw: boolean;
|
public nsfw: boolean;
|
||||||
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||||
public topic: string | null;
|
public topic: string | null;
|
||||||
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||||
public createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
|
|
||||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||||
public setDefaultAutoArchiveDuration(
|
public setDefaultAutoArchiveDuration(
|
||||||
defaultAutoArchiveDuration: ThreadAutoArchiveDuration | 'MAX',
|
defaultAutoArchiveDuration: ThreadAutoArchiveDuration | 'MAX',
|
||||||
@@ -509,11 +507,10 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
|||||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||||
public setType(type: Pick<typeof ChannelType, 'GuildText'>, reason?: string): Promise<TextChannel>;
|
public setType(type: Pick<typeof ChannelType, 'GuildText'>, reason?: string): Promise<TextChannel>;
|
||||||
public setType(type: Pick<typeof ChannelType, 'GuildNews'>, reason?: string): Promise<NewsChannel>;
|
public setType(type: Pick<typeof ChannelType, 'GuildNews'>, reason?: string): Promise<NewsChannel>;
|
||||||
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BaseGuildVoiceChannel extends GuildChannel {
|
export class BaseGuildVoiceChannel extends GuildChannel {
|
||||||
protected constructor(guild: Guild, data?: RawGuildChannelData);
|
public constructor(guild: Guild, data?: RawGuildChannelData);
|
||||||
public get members(): Collection<Snowflake, GuildMember>;
|
public get members(): Collection<Snowflake, GuildMember>;
|
||||||
public get full(): boolean;
|
public get full(): boolean;
|
||||||
public get joinable(): boolean;
|
public get joinable(): boolean;
|
||||||
@@ -1069,9 +1066,8 @@ export class EnumResolvers extends null {
|
|||||||
public static resolveVideoQualityMode(key: VideoQualityModeEnumResolvable | VideoQualityMode): VideoQualityMode;
|
public static resolveVideoQualityMode(key: VideoQualityModeEnumResolvable | VideoQualityMode): VideoQualityMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DMChannel extends TextBasedChannelMixin(Channel, ['bulkDelete']) {
|
export class DMChannel extends TextBasedChannelMixin(Channel, ['bulkDelete', 'fetchWebhooks', 'createWebhook']) {
|
||||||
private constructor(client: Client, data?: RawDMChannelData);
|
private constructor(client: Client, data?: RawDMChannelData);
|
||||||
public messages: MessageManager;
|
|
||||||
public recipientId: Snowflake;
|
public recipientId: Snowflake;
|
||||||
public get recipient(): User | null;
|
public get recipient(): User | null;
|
||||||
public type: ChannelType.DM;
|
public type: ChannelType.DM;
|
||||||
@@ -2409,7 +2405,7 @@ export class TextChannel extends BaseGuildTextChannel {
|
|||||||
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<TextChannel>;
|
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<TextChannel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ThreadChannel extends TextBasedChannelMixin(Channel) {
|
export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhooks', 'createWebhook']) {
|
||||||
private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client, fromInteraction?: boolean);
|
private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client, fromInteraction?: boolean);
|
||||||
public archived: boolean | null;
|
public archived: boolean | null;
|
||||||
public get archivedAt(): Date | null;
|
public get archivedAt(): Date | null;
|
||||||
@@ -2431,7 +2427,6 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel) {
|
|||||||
public get sendable(): boolean;
|
public get sendable(): boolean;
|
||||||
public memberCount: number | null;
|
public memberCount: number | null;
|
||||||
public messageCount: number | null;
|
public messageCount: number | null;
|
||||||
public messages: MessageManager;
|
|
||||||
public members: ThreadMemberManager;
|
public members: ThreadMemberManager;
|
||||||
public name: string;
|
public name: string;
|
||||||
public ownerId: Snowflake | null;
|
public ownerId: Snowflake | null;
|
||||||
@@ -2624,7 +2619,7 @@ export type ComponentData =
|
|||||||
| ModalActionRowComponentData
|
| ModalActionRowComponentData
|
||||||
| ActionRowData<MessageActionRowComponentData | ModalActionRowComponentData>;
|
| ActionRowData<MessageActionRowComponentData | ModalActionRowComponentData>;
|
||||||
|
|
||||||
export class VoiceChannel extends BaseGuildVoiceChannel {
|
export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, ['lastPinTimestamp', 'lastPinAt']) {
|
||||||
public videoQualityMode: VideoQualityMode | null;
|
public videoQualityMode: VideoQualityMode | null;
|
||||||
public get speakable(): boolean;
|
public get speakable(): boolean;
|
||||||
public type: ChannelType.GuildVoice;
|
public type: ChannelType.GuildVoice;
|
||||||
@@ -3374,6 +3369,7 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
|
|||||||
get lastMessage(): Message | null;
|
get lastMessage(): Message | null;
|
||||||
lastPinTimestamp: number | null;
|
lastPinTimestamp: number | null;
|
||||||
get lastPinAt(): Date | null;
|
get lastPinAt(): Date | null;
|
||||||
|
messages: MessageManager;
|
||||||
awaitMessageComponent<T extends MessageComponentType = ComponentType.ActionRow>(
|
awaitMessageComponent<T extends MessageComponentType = ComponentType.ActionRow>(
|
||||||
options?: AwaitMessageCollectorOptionsParams<T, true>,
|
options?: AwaitMessageCollectorOptionsParams<T, true>,
|
||||||
): Promise<MappedInteractionTypes[T]>;
|
): Promise<MappedInteractionTypes[T]>;
|
||||||
@@ -3386,6 +3382,8 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
|
|||||||
options?: MessageChannelCollectorOptionsParams<T, true>,
|
options?: MessageChannelCollectorOptionsParams<T, true>,
|
||||||
): InteractionCollector<MappedInteractionTypes[T]>;
|
): InteractionCollector<MappedInteractionTypes[T]>;
|
||||||
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
||||||
|
createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
|
||||||
|
fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
||||||
sendTyping(): Promise<void>;
|
sendTyping(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3836,7 +3834,7 @@ export interface ClientEvents {
|
|||||||
typingStart: [typing: Typing];
|
typingStart: [typing: Typing];
|
||||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||||
webhookUpdate: [channel: TextChannel | NewsChannel];
|
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel];
|
||||||
interactionCreate: [interaction: Interaction];
|
interactionCreate: [interaction: Interaction];
|
||||||
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
|
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
|
||||||
shardError: [error: Error, shardId: number];
|
shardError: [error: Error, shardId: number];
|
||||||
|
|||||||
@@ -937,9 +937,10 @@ declare const guildMember: GuildMember;
|
|||||||
|
|
||||||
// Test whether the structures implement send
|
// Test whether the structures implement send
|
||||||
expectType<TextBasedChannelFields['send']>(dmChannel.send);
|
expectType<TextBasedChannelFields['send']>(dmChannel.send);
|
||||||
expectType<ThreadChannel>(threadChannel);
|
expectType<TextBasedChannelFields['send']>(threadChannel.send);
|
||||||
expectType<NewsChannel>(newsChannel);
|
expectType<TextBasedChannelFields['send']>(newsChannel.send);
|
||||||
expectType<TextChannel>(textChannel);
|
expectType<TextBasedChannelFields['send']>(textChannel.send);
|
||||||
|
expectType<TextBasedChannelFields['send']>(voiceChannel.send);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(user);
|
expectAssignable<PartialTextBasedChannelFields>(user);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
||||||
|
|
||||||
@@ -947,6 +948,7 @@ expectType<Message | null>(dmChannel.lastMessage);
|
|||||||
expectType<Message | null>(threadChannel.lastMessage);
|
expectType<Message | null>(threadChannel.lastMessage);
|
||||||
expectType<Message | null>(newsChannel.lastMessage);
|
expectType<Message | null>(newsChannel.lastMessage);
|
||||||
expectType<Message | null>(textChannel.lastMessage);
|
expectType<Message | null>(textChannel.lastMessage);
|
||||||
|
expectType<Message | null>(voiceChannel.lastMessage);
|
||||||
|
|
||||||
notPropertyOf(user, 'lastMessage');
|
notPropertyOf(user, 'lastMessage');
|
||||||
notPropertyOf(user, 'lastMessageId');
|
notPropertyOf(user, 'lastMessageId');
|
||||||
@@ -1430,14 +1432,16 @@ declare const GuildBasedChannel: GuildBasedChannel;
|
|||||||
declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
|
declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
|
||||||
declare const GuildTextBasedChannel: GuildTextBasedChannel;
|
declare const GuildTextBasedChannel: GuildTextBasedChannel;
|
||||||
|
|
||||||
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel>(TextBasedChannel);
|
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(TextBasedChannel);
|
||||||
expectType<ChannelType.GuildText | ChannelType.DM | ChannelType.GuildNews | ThreadChannelType>(TextBasedChannelTypes);
|
expectType<ChannelType.GuildText | ChannelType.DM | ChannelType.GuildNews | ChannelType.GuildVoice | ThreadChannelType>(
|
||||||
|
TextBasedChannelTypes,
|
||||||
|
);
|
||||||
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
||||||
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | ThreadChannel | VoiceChannel>(
|
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | ThreadChannel | VoiceChannel>(
|
||||||
GuildBasedChannel,
|
GuildBasedChannel,
|
||||||
);
|
);
|
||||||
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | VoiceChannel>(NonThreadGuildBasedChannel);
|
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | VoiceChannel>(NonThreadGuildBasedChannel);
|
||||||
expectType<NewsChannel | TextChannel | ThreadChannel>(GuildTextBasedChannel);
|
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(GuildTextBasedChannel);
|
||||||
|
|
||||||
const button = new ButtonBuilder({
|
const button = new ButtonBuilder({
|
||||||
label: 'test',
|
label: 'test',
|
||||||
|
|||||||
Reference in New Issue
Block a user