MCPcopy
hub / github.com/Rapptz/discord.py / parse_channel_delete

Method parse_channel_delete

discord/state.py:869–888  ·  view source on GitHub ↗
(self, data: gw.ChannelDeleteEvent)

Source from the content-addressed store, hash-verified

867 self.dispatch('invite_delete', invite)
868
869 def parse_channel_delete(self, data: gw.ChannelDeleteEvent) -> None:
870 guild = self._get_guild(utils._get_as_snowflake(data, 'guild_id'))
871 channel_id = int(data['id'])
872 if guild is not None:
873 channel = guild.get_channel(channel_id)
874 if channel is not None:
875 guild._remove_channel(channel)
876 self.dispatch('guild_channel_delete', channel)
877
878 if channel.type in (ChannelType.voice, ChannelType.stage_voice):
879 for s in guild.scheduled_events:
880 if s.channel_id == channel.id:
881 guild._scheduled_events.pop(s.id)
882 self.dispatch('scheduled_event_delete', s)
883
884 threads = guild._remove_threads_by_channel(channel_id)
885
886 for thread in threads:
887 self.dispatch('thread_delete', thread)
888 self.dispatch('raw_thread_delete', RawThreadDeleteEvent._from_thread(thread))
889
890 def parse_channel_update(self, data: gw.ChannelUpdateEvent) -> None:
891 channel_type = try_enum(ChannelType, data.get('type'))

Callers

nothing calls this directly

Calls 7

_get_guildMethod · 0.95
_remove_channelMethod · 0.80
popMethod · 0.80
_from_threadMethod · 0.80
get_channelMethod · 0.45
dispatchMethod · 0.45

Tested by

no test coverage detected