mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
autoconvert handler messages
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
|
||||
import { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
|
||||
|
||||
export async function handleGuildBanAdd(data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove;
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id);
|
||||
const payload = data.d as GuildBanAddRemove;
|
||||
const guild = await cacheHandlers.get("guilds", payload.guildId);
|
||||
if (!guild) return;
|
||||
|
||||
const member = await cacheHandlers.get("members", payload.user.id);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
|
||||
import { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
|
||||
|
||||
export async function handleGuildBanRemove(data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove;
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id);
|
||||
const payload = data.d as GuildBanAddRemove;
|
||||
const guild = await cacheHandlers.get("guilds", payload.guildId);
|
||||
if (!guild) return;
|
||||
|
||||
const member = await cacheHandlers.get("members", payload.user.id);
|
||||
|
||||
@@ -2,14 +2,14 @@ import { eventHandlers } from "../../bot.ts";
|
||||
import { cache, cacheHandlers } from "../../cache.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuild } from "../../types/guilds/guild.ts";
|
||||
import { Guild } from "../../types/guilds/guild.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export async function handleGuildCreate(
|
||||
data: DiscordGatewayPayload,
|
||||
shardId: number,
|
||||
) {
|
||||
const payload = data.d as DiscordGuild;
|
||||
const payload = data.d as Guild;
|
||||
// When shards resume they emit GUILD_CREATE again.
|
||||
if (await cacheHandlers.has("guilds", payload.id)) return;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordUnavailableGuild } from "../../types/guilds/unavailable_guild.ts";
|
||||
import { UnavailableGuild } from "../../types/guilds/unavailable_guild.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export async function handleGuildDelete(
|
||||
data: DiscordGatewayPayload,
|
||||
shardId: number,
|
||||
) {
|
||||
const payload = data.d as DiscordUnavailableGuild;
|
||||
const payload = data.d as UnavailableGuild;
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", payload.id);
|
||||
if (!guild) return;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuildIntegrationsUpdate } from "../../types/integration/guild_integrations_update.ts";
|
||||
import { GuildIntegrationsUpdate } from "../../types/integration/guild_integrations_update.ts";
|
||||
|
||||
export async function handleGuildIntegrationsUpdate(
|
||||
data: DiscordGatewayPayload,
|
||||
) {
|
||||
const payload = data.d as DiscordGuildIntegrationsUpdate;
|
||||
const payload = data.d as GuildIntegrationsUpdate;
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id);
|
||||
const guild = await cacheHandlers.get("guilds", payload.guildId);
|
||||
if (!guild) return;
|
||||
|
||||
eventHandlers.guildIntegrationsUpdate?.(guild);
|
||||
|
||||
@@ -2,10 +2,10 @@ import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { GuildUpdateChange } from "../../types/discordeno/guild_update_change.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuild } from "../../types/guilds/guild.ts";
|
||||
import { Guild } from "../../types/guilds/guild.ts";
|
||||
|
||||
export async function handleGuildUpdate(data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuild;
|
||||
const payload = data.d as Guild;
|
||||
const newGuild = await cacheHandlers.get("guilds", payload.id);
|
||||
if (!newGuild) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user