mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
parent
76b9f0efe8
commit
406b09387c
@ -715,15 +715,30 @@ export abstract class BaseVoiceChannel extends GuildChannel {
|
||||
export class DMChannel extends BaseChannel implements Model {
|
||||
constructor(session: Session, data: DiscordChannel) {
|
||||
super(session, data);
|
||||
this.user = new User(this.session, data.recipents!.find(r => r.id !== this.session.botId)!);
|
||||
this.type = data.type as ChannelTypes.DM | ChannelTypes.GroupDm;
|
||||
|
||||
if (data.owner_id && data.recipents) {
|
||||
this.user = new User(session, data.recipents.find(user => user.id === data.owner_id)!);
|
||||
} else {
|
||||
this.user = new User(session, data.recipents!.find(user => user.id === this.session.botId)!);
|
||||
}
|
||||
|
||||
if (data.recipents && data.recipents.length > 1) {
|
||||
this.group = data.recipents.map(r => new User(this.session, r));
|
||||
}
|
||||
|
||||
this.type = ChannelTypes.GroupDm | ChannelTypes.GroupDm;
|
||||
|
||||
if (data.last_message_id) {
|
||||
this.lastMessageId = data.last_message_id;
|
||||
}
|
||||
}
|
||||
|
||||
override type: ChannelTypes.DM | ChannelTypes.GroupDm;
|
||||
/** Onwer of the dm channel. */
|
||||
user: User;
|
||||
/** If the channel is a DM Group it's has multiple users. */
|
||||
group?: User[];
|
||||
/** Last message id. */
|
||||
lastMessageId?: Snowflake;
|
||||
|
||||
async close(): Promise<DMChannel> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user