parse method
Parse the raw
data received from the API into an instance of the type of this manager.
Implementation
@override
Channel parse(Map<String, Object?> raw, {Snowflake? guildId}) {
final type = ChannelType.parse(raw['type'] as int);
final parsers = {
ChannelType.guildText: parseGuildTextChannel,
ChannelType.dm: parseDmChannel,
ChannelType.guildVoice: parseGuildVoiceChannel,
ChannelType.groupDm: parseGroupDmChannel,
ChannelType.guildCategory: parseGuildCategory,
ChannelType.guildAnnouncement: parseGuildAnnouncementChannel,
ChannelType.announcementThread: parseAnnouncementThread,
ChannelType.publicThread: parsePublicThread,
ChannelType.privateThread: parsePrivateThread,
ChannelType.guildStageVoice: parseGuildStageChannel,
ChannelType.guildDirectory: parseDirectoryChannel,
ChannelType.guildForum: parseForumChannel,
ChannelType.guildMedia: parseGuildMediaChannel,
};
return parsers[type]!(raw, guildId: guildId);
}