mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
TODO done: targetApplication implemented & Minor changes
This commit is contained in:
parent
4177ab162d
commit
a7317a0a3c
@ -8,6 +8,7 @@ import type {
|
||||
ScheduledEventEntityType,
|
||||
ScheduledEventPrivacyLevel,
|
||||
ScheduledEventStatus,
|
||||
DiscordApplication
|
||||
} from "../../discordeno/mod.ts";
|
||||
import { TargetTypes } from "../../discordeno/mod.ts";
|
||||
import { GuildChannel } from "./channels.ts";
|
||||
@ -15,6 +16,7 @@ import { Member } from "./Member.ts";
|
||||
import InviteGuild from "./guilds/InviteGuild.ts";
|
||||
import User from "./User.ts";
|
||||
import Guild from "./guilds/Guild.ts";
|
||||
import Application from "./Application.ts";
|
||||
|
||||
export interface InviteStageInstance {
|
||||
/** The members speaking in the Stage */
|
||||
@ -53,29 +55,21 @@ export class Invite {
|
||||
constructor(session: Session, data: DiscordInvite) {
|
||||
this.session = session;
|
||||
|
||||
if (data.guild) {
|
||||
this.guild = new InviteGuild(session, data.guild);
|
||||
}
|
||||
|
||||
if (data.approximate_member_count) {
|
||||
this.approximateMemberCount = data.approximate_member_count;
|
||||
}
|
||||
|
||||
if (data.approximate_presence_count) {
|
||||
this.approximatePresenceCount = data.approximate_presence_count;
|
||||
}
|
||||
this.guild = data.guild ? new InviteGuild(session, data.guild) : undefined;
|
||||
this.approximateMemberCount = data.approximate_member_count ? data.approximate_member_count : undefined;
|
||||
this.approximatePresenceCount = data.approximate_presence_count ? data.approximate_presence_count : undefined;
|
||||
this.code = data.code;
|
||||
this.expiresAt = data.expires_at ? Number.parseInt(data.expires_at) : undefined;
|
||||
this.inviter = data.inviter ? new User(session, data.inviter) : undefined;
|
||||
this.targetUser = data.target_user ? new User(session, data.target_user) : undefined;
|
||||
this.targetApplication = data.target_application ? new Application(session, data.target_application as DiscordApplication) : undefined;
|
||||
this.targetType = data.target_type;
|
||||
|
||||
if (data.channel) {
|
||||
const guildId = (data.guild && data.guild?.id) ? data.guild.id : "";
|
||||
this.channel = new GuildChannel(session, data.channel as DiscordChannel, guildId);
|
||||
}
|
||||
|
||||
this.code = data.code;
|
||||
|
||||
if (data.expires_at) {
|
||||
this.expiresAt = Number.parseInt(data.expires_at);
|
||||
}
|
||||
|
||||
if (data.guild_scheduled_event) {
|
||||
this.guildScheduledEvent = {
|
||||
id: data.guild_scheduled_event.id,
|
||||
@ -105,14 +99,6 @@ export class Invite {
|
||||
};
|
||||
}
|
||||
|
||||
if (data.inviter) {
|
||||
this.inviter = new User(session, data.inviter);
|
||||
}
|
||||
|
||||
if (data.target_user) {
|
||||
this.targetUser = new User(session, data.target_user);
|
||||
}
|
||||
|
||||
if (data.stage_instance) {
|
||||
const guildId = (data.guild && data.guild?.id) ? data.guild.id : "";
|
||||
this.stageInstance = {
|
||||
@ -124,13 +110,6 @@ export class Invite {
|
||||
topic: data.stage_instance.topic,
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: create Application structure
|
||||
// this.targetApplication = data.target_application
|
||||
|
||||
if (data.target_type) {
|
||||
this.targetType = data.target_type;
|
||||
}
|
||||
}
|
||||
|
||||
readonly session: Session;
|
||||
@ -145,8 +124,7 @@ export class Invite {
|
||||
channel?: Partial<GuildChannel>;
|
||||
stageInstance?: InviteStageInstance;
|
||||
guildScheduledEvent?: InviteScheduledEvent;
|
||||
// TODO: create Application structure
|
||||
// targetApplication?: Partial<Application>
|
||||
targetApplication?: Partial<Application>
|
||||
|
||||
async delete(): Promise<Invite> {
|
||||
await Guild.prototype.deleteInvite.call(this.guild, this.code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user