mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
dry code a bit
This commit is contained in:
parent
c6e6a6392e
commit
852e4d58c6
@ -1,16 +1,23 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Snowflake } from "../util/Snowflake.ts";
|
||||
import type { Session } from "../session/Session.ts";
|
||||
import type { DiscordChannel } from "../vendor/external.ts";
|
||||
import Channel from "./Channel.ts";
|
||||
import User from "./User.ts";
|
||||
import * as Routes from "../util/Routes.ts";
|
||||
|
||||
export class DMChannel extends Channel {
|
||||
export class DMChannel extends Channel implements Model {
|
||||
constructor(session: Session, data: DiscordChannel) {
|
||||
super(session, data);
|
||||
data.last_message_id ? this.lastMessageId = data.last_message_id : undefined;
|
||||
// Waiting for implementation of botId in session
|
||||
//this.user = new User(this.session, data.recipents!.find((r) => r.id !== this.session.botId));
|
||||
|
||||
this.user = new User(this.session, data.recipents!.find((r) => r.id !== this.session.botId)!);
|
||||
|
||||
if (data.last_message_id) {
|
||||
this.lastMessageId = data.last_message_id;
|
||||
}
|
||||
}
|
||||
|
||||
user: User;
|
||||
lastMessageId?: Snowflake;
|
||||
|
||||
async close() {
|
||||
|
@ -4,7 +4,6 @@ import type { GetMessagesOptions, GetReactions } from "../util/Routes.ts";
|
||||
import type { DiscordChannel, DiscordInvite, DiscordMessage, TargetTypes } from "../vendor/external.ts";
|
||||
import type { ReactionResolvable } from "./Message.ts";
|
||||
import GuildChannel from "./GuildChannel.ts";
|
||||
import Guild from "./Guild.ts";
|
||||
import ThreadChannel from "./ThreadChannel.ts";
|
||||
import Message from "./Message.ts";
|
||||
import Invite from "./Invite.ts";
|
||||
@ -38,7 +37,7 @@ export interface ThreadCreateOptions {
|
||||
}
|
||||
|
||||
export class TextChannel extends GuildChannel {
|
||||
constructor(session: Session, data: DiscordChannel, guildId: Guild["id"]) {
|
||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||
super(session, data, guildId);
|
||||
data.last_message_id ? this.lastMessageId = data.last_message_id : undefined;
|
||||
data.last_pin_timestamp ? this.lastPinTimestamp = data.last_pin_timestamp : undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user