mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
feat(controllers): add VOICE_SERVER_UPDATE event (#652)
This commit is contained in:
15
src/api/controllers/VOICE_SERVER_UPDATE.ts
Normal file
15
src/api/controllers/VOICE_SERVER_UPDATE.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import {
|
||||
DiscordPayload,
|
||||
DiscordVoiceServerUpdateEvent,
|
||||
} from "../../types/mod.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleVoiceServerUpdate(data: DiscordPayload) {
|
||||
const payload = data.d as DiscordVoiceServerUpdateEvent;
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id);
|
||||
if (!guild) return;
|
||||
|
||||
eventHandlers.voiceServerUpdate?.(payload.token, guild, payload.endpoint);
|
||||
}
|
||||
@@ -55,6 +55,7 @@ import {
|
||||
handleInternalGuildRoleDelete,
|
||||
handleInternalGuildRoleUpdate,
|
||||
} from "./roles.ts";
|
||||
import { handleVoiceServerUpdate } from "./VOICE_SERVER_UPDATE.ts";
|
||||
|
||||
export let controllers = {
|
||||
READY: handleInternalReady,
|
||||
@@ -90,6 +91,7 @@ export let controllers = {
|
||||
TYPING_START: handleInternalTypingStart,
|
||||
USER_UPDATE: handleInternalUserUpdate,
|
||||
VOICE_STATE_UPDATE: handleInternalVoiceStateUpdate,
|
||||
VOICE_SERVER_UPDATE: handleVoiceServerUpdate,
|
||||
WEBHOOKS_UPDATE: handleInternalWebhooksUpdate,
|
||||
INTEGRATION_CREATE: handleInternalIntegrationCreate,
|
||||
INTEGRATION_UPDATE: handleInternalIntegrationUpdate,
|
||||
|
||||
@@ -225,6 +225,12 @@ export interface EventHandlers {
|
||||
member: Member,
|
||||
voiceState: VoiceStateUpdatePayload,
|
||||
) => unknown;
|
||||
/** Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server. */
|
||||
voiceServerUpdate?: (
|
||||
token: string,
|
||||
guild: Guild,
|
||||
endpoint: string,
|
||||
) => unknown;
|
||||
/** Sent when a guild channel's webhook is created, updated, or deleted. */
|
||||
webhooksUpdate?: (channelID: string, guildID: string) => unknown;
|
||||
/** Sent when a member has passed the guild's Membership Screening requirements */
|
||||
|
||||
Reference in New Issue
Block a user