fix: dumb bug on api-types

This commit is contained in:
Yuzu 2022-09-12 18:49:47 -05:00
parent a4c776ffa4
commit afe3a38e4b
2 changed files with 6 additions and 6 deletions

View File

@ -753,7 +753,7 @@ export interface DiscordChannel {
/** When a thread is created this will be true on that channel payload for the thread. */ /** When a thread is created this will be true on that channel payload for the thread. */
newly_created?: boolean; newly_created?: boolean;
/** The recipients of the DM*/ /** The recipients of the DM*/
recipents?: DiscordUser[]; recipients?: DiscordUser[];
} }
/** https://discord.com/developers/docs/topics/gateway#presence-update */ /** https://discord.com/developers/docs/topics/gateway#presence-update */

View File

@ -719,14 +719,14 @@ export class DMChannel extends BaseChannel implements Model {
constructor(session: Session, data: DiscordChannel) { constructor(session: Session, data: DiscordChannel) {
super(session, data); super(session, data);
if (data.owner_id && data.recipents) { if (data.owner_id && data.recipients) {
this.user = new User(session, data.recipents.find(user => user.id === data.owner_id)!); this.user = new User(session, data.recipients.find(user => user.id === data.owner_id)!);
} else { } else {
this.user = new User(session, data.recipents!.find(user => user.id === this.session.botId)!); this.user = new User(session, data.recipients!.find(user => user.id === this.session.botId)!);
} }
if (data.recipents && data.recipents.length > 1) { if (data.recipients && data.recipients.length > 1) {
this.group = data.recipents.map(r => new User(this.session, r)); this.group = data.recipients.map(r => new User(this.session, r));
} }
this.type = data.type as ChannelTypes.GroupDm | ChannelTypes.GroupDm; this.type = data.type as ChannelTypes.GroupDm | ChannelTypes.GroupDm;