mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
StageInstance & GuildScheduledEvents
This commit is contained in:
parent
b7da3bc621
commit
c1c358a411
@ -32,7 +32,8 @@ import type {
|
||||
DiscordUser,
|
||||
DiscordWebhookUpdate,
|
||||
DiscordInviteCreate,
|
||||
DiscordInviteDelete
|
||||
DiscordInviteDelete,
|
||||
DiscordScheduledEvent
|
||||
} from "../discordeno/mod.ts";
|
||||
|
||||
import type { Snowflake } from "./Snowflake.ts";
|
||||
@ -42,6 +43,8 @@ import type { Interaction } from "./structures/interactions/InteractionFactory.t
|
||||
import { AutoModerationRule } from "./structures/AutoModerationRule.ts";
|
||||
import { AutoModerationExecution } from "./structures/AutoModerationExecution.ts";
|
||||
import { type Channel, ChannelFactory, GuildChannel, ThreadChannel } from "./structures/channels.ts";
|
||||
import { StageInstance, type DiscordStageInstance } from "./structures/StageInstance.ts";
|
||||
import { ScheduledEvent } from "./structures/GuildScheduledEvent.ts";
|
||||
|
||||
import ThreadMember from "./structures/ThreadMember.ts";
|
||||
import Member from "./structures/Member.ts";
|
||||
@ -285,6 +288,30 @@ export const INVITE_DELETE: RawHandler<DiscordInviteDelete> = (session, _shardId
|
||||
session.emit("inviteDelete", { channelId: data.channel_id, guildId: data.guild_id, code: data.code });
|
||||
}
|
||||
|
||||
export const STAGE_INSTANCE_CREATE: RawHandler<DiscordStageInstance> = (session, _shardId, payload) => {
|
||||
session.emit("stageInstanceCreate", new StageInstance(session, payload));
|
||||
};
|
||||
|
||||
export const STAGE_INSTANCE_UPDATE: RawHandler<DiscordStageInstance> = (session, _shardId, payload) => {
|
||||
session.emit("stageInstanceUpdate", new StageInstance(session, payload));
|
||||
};
|
||||
|
||||
export const STAGE_INSTANCE_DELETE: RawHandler<DiscordStageInstance> = (session, _shardId, payload) => {
|
||||
session.emit("stageInstanceDelete", new StageInstance(session, payload));
|
||||
};
|
||||
|
||||
export const GUILD_SCHEDULED_EVENT_CREATE: RawHandler<DiscordScheduledEvent> = (session, _shardId, payload) => {
|
||||
session.emit("guildScheduledEventCreate", new ScheduledEvent(session, payload))
|
||||
}
|
||||
|
||||
export const GUILD_SCHEDULED_EVENT_UPDATE: RawHandler<DiscordScheduledEvent> = (session, _shardId, payload) => {
|
||||
session.emit("guildScheduledEventUpdate", new ScheduledEvent(session, payload))
|
||||
}
|
||||
|
||||
export const GUILD_SCHEDULED_EVENT_DELETE: RawHandler<DiscordScheduledEvent> = (session, _shardId, payload) => {
|
||||
session.emit("guildScheduledEventDelete", new ScheduledEvent(session, payload))
|
||||
}
|
||||
|
||||
export const raw: RawHandler<unknown> = (session, shardId, data) => {
|
||||
session.emit("raw", data, shardId);
|
||||
};
|
||||
@ -336,6 +363,12 @@ export interface Events {
|
||||
"autoModerationRuleUpdate": Handler<[AutoModerationRule]>;
|
||||
"autoModerationRuleDelete": Handler<[AutoModerationRule]>;
|
||||
"autoModerationActionExecution":Handler<[AutoModerationExecution]>
|
||||
"stageInstanceCreate": Handler<[StageInstance]>;
|
||||
"stageInstanceUpdate": Handler<[StageInstance]>;
|
||||
"stageInstanceDelete": Handler<[StageInstance]>;
|
||||
"guildScheduledEventCreate": Handler<[ScheduledEvent]>;
|
||||
"guildScheduledEventUpdate": Handler<[ScheduledEvent]>;
|
||||
"guildScheduledEventDelete": Handler<[ScheduledEvent]>;
|
||||
"raw": Handler<[unknown, number]>;
|
||||
"webhooksUpdate": Handler<[{ guildId: Snowflake, channelId: Snowflake }]>;
|
||||
"userUpdate": Handler<[User]>;
|
||||
|
49
packages/biscuit/structures/GuildScheduledEvent.ts
Normal file
49
packages/biscuit/structures/GuildScheduledEvent.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Snowflake } from "../Snowflake.ts";
|
||||
import type { Session } from "../Session.ts";
|
||||
import { PrivacyLevels } from "./StageInstance.ts";
|
||||
import type {
|
||||
DiscordScheduledEvent,
|
||||
ScheduledEventStatus,
|
||||
ScheduledEventEntityType,
|
||||
DiscordScheduledEventEntityMetadata
|
||||
} from "../../discordeno/mod.ts";
|
||||
import User from "./User.ts";
|
||||
|
||||
export class ScheduledEvent implements Model {
|
||||
constructor(session: Session, data: DiscordScheduledEvent) {
|
||||
this.session = session;
|
||||
this.id = data.id;
|
||||
this.guildId = data.guild_id;
|
||||
this.channelId = data.channel_id;
|
||||
this.creatorId = data.creator_id ? data.creator_id : undefined;
|
||||
this.name = data.name;
|
||||
this.description = data.description;
|
||||
this.scheduledStartTime = data.scheduled_start_time;
|
||||
this.scheduledEndTime = data.scheduled_end_time;
|
||||
this.privacyLevel = PrivacyLevels.GuildOnly;
|
||||
this.status = data.status;
|
||||
this.entityType = data.entity_type;
|
||||
this.entityMetadata = data.entity_metadata ? data.entity_metadata : undefined;
|
||||
this.creator = data.creator ? new User(session, data.creator) : undefined;
|
||||
this.userCount = data.user_count;
|
||||
this.image = data.image ? data.image : undefined;
|
||||
}
|
||||
session: Session;
|
||||
id: Snowflake;
|
||||
guildId: Snowflake;
|
||||
channelId: Snowflake | null;
|
||||
creatorId?: Snowflake;
|
||||
name: string;
|
||||
description?: string;
|
||||
scheduledStartTime: string;
|
||||
scheduledEndTime: string | null;
|
||||
privacyLevel: PrivacyLevels;
|
||||
status: ScheduledEventStatus;
|
||||
entityType: ScheduledEventEntityType;
|
||||
entityMetadata?: DiscordScheduledEventEntityMetadata;
|
||||
creator?: User;
|
||||
userCount?: number;
|
||||
image?: string;
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ import type { Snowflake } from "../Snowflake.ts";
|
||||
import type { DiscordStageInstance as DiscordAutoClosingStageInstance } from "../../discordeno/mod.ts";
|
||||
import * as Routes from "../Routes.ts";
|
||||
|
||||
interface DiscordStageInstance extends DiscordAutoClosingStageInstance {
|
||||
export interface DiscordStageInstance extends DiscordAutoClosingStageInstance {
|
||||
privacy_level: PrivacyLevels;
|
||||
discoverable_disabled: boolean;
|
||||
guild_scheduled_event_id: Snowflake;
|
||||
|
Loading…
x
Reference in New Issue
Block a user