feat(Message): add call

#10283 backport
This commit is contained in:
Elysia
2024-09-17 19:30:44 +07:00
parent 93b4118145
commit 4abb56e265
2 changed files with 31 additions and 0 deletions

View File

@@ -371,6 +371,30 @@ class Message extends Base {
} else {
this.interaction ??= 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;
}
}
/**