autoconvert handler messages

This commit is contained in:
ITOH
2021-04-24 23:17:11 +02:00
parent 6d4c51a4eb
commit be2bbbdd99
54 changed files with 181 additions and 248 deletions
+4 -4
View File
@@ -1,19 +1,19 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordChannel } from "../../types/channels/channel.ts";
import { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
export async function handleChannelDelete(data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel;
const payload = data.d as Channel;
const cachedChannel = await cacheHandlers.get("channels", payload.id);
if (!cachedChannel) return;
if (
cachedChannel.type === DiscordChannelTypes.GUILD_VOICE && payload.guild_id
cachedChannel.type === DiscordChannelTypes.GUILD_VOICE && payload.guildId
) {
const guild = await cacheHandlers.get("guilds", payload.guild_id);
const guild = await cacheHandlers.get("guilds", payload.guildId);
if (guild) {
return Promise.all(guild.voiceStates.map(async (vs, key) => {