mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: easier guards for channelUpdate (#5716)
* feat: easier guards for channelUpdate * typings: more explicit typings for client events involving channels * docs: event doc consistency regarding channel types
This commit is contained in:
@@ -40,7 +40,7 @@ class TypingStart extends Action {
|
|||||||
/**
|
/**
|
||||||
* Emitted whenever a user starts typing in a channel.
|
* Emitted whenever a user starts typing in a channel.
|
||||||
* @event Client#typingStart
|
* @event Client#typingStart
|
||||||
* @param {Channel} channel The channel the user started typing in
|
* @param {DMChannel|TextChannel|NewsChannel} channel The channel the user started typing in
|
||||||
* @param {User} user The user that started typing
|
* @param {User} user The user that started typing
|
||||||
*/
|
*/
|
||||||
this.client.emit(Events.TYPING_START, channel, user);
|
this.client.emit(Events.TYPING_START, channel, user);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = (client, { d: data }) => {
|
|||||||
* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event,
|
* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event,
|
||||||
* not much information can be provided easily here - you need to manually check the pins yourself.
|
* not much information can be provided easily here - you need to manually check the pins yourself.
|
||||||
* @event Client#channelPinsUpdate
|
* @event Client#channelPinsUpdate
|
||||||
* @param {DMChannel|TextChannel} channel The channel that the pins update occurred in
|
* @param {DMChannel|TextChannel|NewsChannel} channel The channel that the pins update occurred in
|
||||||
* @param {Date} time The time of the pins update
|
* @param {Date} time The time of the pins update
|
||||||
*/
|
*/
|
||||||
client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
|
client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
|
||||||
|
|||||||
6
typings/index.d.ts
vendored
6
typings/index.d.ts
vendored
@@ -2603,8 +2603,8 @@ declare module 'discord.js' {
|
|||||||
applicationCommandUpdate: [oldCommand: ApplicationCommand | null, newCommand: ApplicationCommand];
|
applicationCommandUpdate: [oldCommand: ApplicationCommand | null, newCommand: ApplicationCommand];
|
||||||
channelCreate: [channel: GuildChannel];
|
channelCreate: [channel: GuildChannel];
|
||||||
channelDelete: [channel: DMChannel | GuildChannel];
|
channelDelete: [channel: DMChannel | GuildChannel];
|
||||||
channelPinsUpdate: [channel: Channel | PartialDMChannel, date: Date];
|
channelPinsUpdate: [channel: TextChannel | NewsChannel | DMChannel | PartialDMChannel, date: Date];
|
||||||
channelUpdate: [oldChannel: Channel, newChannel: Channel];
|
channelUpdate: [oldChannel: DMChannel | GuildChannel, newChannel: DMChannel | GuildChannel];
|
||||||
debug: [message: string];
|
debug: [message: string];
|
||||||
warn: [message: string];
|
warn: [message: string];
|
||||||
emojiCreate: [emoji: GuildEmoji];
|
emojiCreate: [emoji: GuildEmoji];
|
||||||
@@ -2646,7 +2646,7 @@ declare module 'discord.js' {
|
|||||||
roleCreate: [role: Role];
|
roleCreate: [role: Role];
|
||||||
roleDelete: [role: Role];
|
roleDelete: [role: Role];
|
||||||
roleUpdate: [oldRole: Role, newRole: Role];
|
roleUpdate: [oldRole: Role, newRole: Role];
|
||||||
typingStart: [channel: Channel | PartialDMChannel, user: User | PartialUser];
|
typingStart: [channel: TextChannel | NewsChannel | DMChannel | PartialDMChannel, user: User | PartialUser];
|
||||||
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];
|
webhookUpdate: [channel: TextChannel];
|
||||||
|
|||||||
Reference in New Issue
Block a user