From 0e358056a6aeb716de23b354416a2cebc5bdf845 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 20 Apr 2024 00:40:44 +0100 Subject: [PATCH] Store all channels in channel cache --- lib/nostrum/shard/dispatch.ex | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/nostrum/shard/dispatch.ex b/lib/nostrum/shard/dispatch.ex index fbcc406f5..f1b7c9912 100644 --- a/lib/nostrum/shard/dispatch.ex +++ b/lib/nostrum/shard/dispatch.ex @@ -89,17 +89,12 @@ defmodule Nostrum.Shard.Dispatch do def handle_event(:AUTO_MODERATION_RULE_EXECUTION = event, p, state), do: {event, AutoModerationRuleExecute.to_struct(p), state} - def handle_event(:CHANNEL_CREATE = event, %{type: t} = p, state) when t in [0, 2] do + def handle_event(:CHANNEL_CREATE = event, p, state) do ChannelGuildMapping.create(p.id, p.guild_id) {event, GuildCache.channel_create(p.guild_id, p), state} end - # Ignore group channels - def handle_event(:CHANNEL_CREATE, _p, _state) do - :noop - end - - def handle_event(:CHANNEL_DELETE = event, %{type: t} = p, state) when t in [0, 2] do + def handle_event(:CHANNEL_DELETE = event, p, state) do ChannelGuildMapping.delete(p.id) {event, GuildCache.channel_delete(p.guild_id, p.id), state} end @@ -108,11 +103,6 @@ defmodule Nostrum.Shard.Dispatch do {event, GuildCache.channel_update(p.guild_id, p), state} end - def handle_event(:CHANNEL_DELETE, _p, _state) do - # Ignore group channels - :noop - end - def handle_event(:CHANNEL_PINS_ACK = event, p, state), do: {event, p, state} def handle_event(:CHANNEL_PINS_UPDATE = event, p, state) do