mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat(Message): add call (#10283)
* feat(Message): add `call` * refactor: make `endedAt` a getter * types: fix `endedAt` return type * types(Message): add `call` property * docs: requested changes --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -417,6 +417,30 @@ class Message extends Base {
|
|||||||
} else {
|
} else {
|
||||||
this.poll ??= null;
|
this.poll ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A call associated with a message
|
||||||
|
* @typedef {Object} MessageCall
|
||||||
|
* @property {Readonly<?Date>} endedAt The time the call ended
|
||||||
|
* @property {?number} endedTimestamp The timestamp the call ended
|
||||||
|
* @property {Snowflake[]} participants The ids of the users that participated in the call
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (data.call) {
|
||||||
|
/**
|
||||||
|
* The call associated with the message
|
||||||
|
* @type {?MessageCall}
|
||||||
|
*/
|
||||||
|
this.call = {
|
||||||
|
endedTimestamp: data.call.ended_timestamp ? Date.parse(data.call.ended_timestamp) : null,
|
||||||
|
participants: data.call.participants,
|
||||||
|
get endedAt() {
|
||||||
|
return this.endedTimestamp && new Date(this.endedTimestamp);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.call ??= null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
7
packages/discord.js/typings/index.d.ts
vendored
7
packages/discord.js/typings/index.d.ts
vendored
@@ -2027,6 +2027,12 @@ export class LimitedCollection<Key, Value> extends Collection<Key, Value> {
|
|||||||
public keepOverLimit: ((value: Value, key: Key, collection: this) => boolean) | null;
|
public keepOverLimit: ((value: Value, key: Key, collection: this) => boolean) | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MessageCall {
|
||||||
|
get endedAt(): Date | null;
|
||||||
|
endedTimestamp: number | null;
|
||||||
|
participants: readonly Snowflake[];
|
||||||
|
}
|
||||||
|
|
||||||
export type MessageComponentType = Exclude<ComponentType, ComponentType.TextInput | ComponentType.ActionRow>;
|
export type MessageComponentType = Exclude<ComponentType, ComponentType.TextInput | ComponentType.ActionRow>;
|
||||||
|
|
||||||
export interface MessageCollectorOptionsParams<
|
export interface MessageCollectorOptionsParams<
|
||||||
@@ -2118,6 +2124,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
|
|||||||
public get thread(): AnyThreadChannel | null;
|
public get thread(): AnyThreadChannel | null;
|
||||||
public tts: boolean;
|
public tts: boolean;
|
||||||
public poll: Poll | null;
|
public poll: Poll | null;
|
||||||
|
public call: MessageCall | null;
|
||||||
public type: MessageType;
|
public type: MessageType;
|
||||||
public get url(): string;
|
public get url(): string;
|
||||||
public webhookId: Snowflake | null;
|
public webhookId: Snowflake | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user