mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
Add Integration structure
This commit is contained in:
parent
9a5a25c2d5
commit
1e527cd24c
55
structures/Integration.ts
Normal file
55
structures/Integration.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Snowflake } from "../util/Snowflake.ts";
|
||||
import type { Session } from "../session/Session.ts";
|
||||
import type {
|
||||
DiscordIntegration,
|
||||
DiscordIntegrationAccount,
|
||||
DiscordIntegrationApplication,
|
||||
DiscordUser,
|
||||
IntegrationExpireBehaviors
|
||||
} from "../vendor/external.ts";
|
||||
|
||||
export class Integration implements Model {
|
||||
constructor(session: Session, data: DiscordIntegration & { guild_id?: string }) {
|
||||
this.id = data.id;
|
||||
this.session = session;
|
||||
|
||||
data.guild_id ? this.guildId = data.guild_id : null;
|
||||
|
||||
this.name = data.name;
|
||||
this.type = data.type;
|
||||
this.enabled = !!data.enabled;
|
||||
this.syncing = !!data.syncing;
|
||||
this.roleId = data.role_id;
|
||||
this.enableEmoticons = !!data.enable_emoticons;
|
||||
this.expireBehavior = data.expire_behavior;
|
||||
this.expireGracePeriod = data.expire_grace_period;
|
||||
this.syncedAt = data.synced_at;
|
||||
this.subscriberCount = data.subscriber_count;
|
||||
this.revoked = !!data.revoked;
|
||||
|
||||
this.user = data.user;
|
||||
this.account = data.account;
|
||||
this.application = data.application;
|
||||
}
|
||||
|
||||
id: Snowflake;
|
||||
session: Session;
|
||||
guildId?: string;
|
||||
|
||||
name: string
|
||||
type: "twitch" | "youtube" | "discord";
|
||||
enabled?: boolean;
|
||||
syncing?: boolean;
|
||||
roleId?: string;
|
||||
enableEmoticons?: boolean;
|
||||
expireBehavior?: IntegrationExpireBehaviors;
|
||||
expireGracePeriod?: number;
|
||||
syncedAt?: string;
|
||||
subscriberCount?: number;
|
||||
revoked?: boolean;
|
||||
|
||||
user?: DiscordUser;
|
||||
account?: DiscordIntegrationAccount;
|
||||
application?: DiscordIntegrationApplication;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user