import { ChannelTypes } from '@src/constants' ; import { Entities } from '@src/api/entities/Entities' ; type EntityKeys = keyof typeof Entities ; export function channelEntityKey ( data ) { switch ( data ?. type as ChannelTypes ) { case ChannelTypes . DM : case ChannelTypes . GROUP_DM : return 'DirectMessagesChannel' ; case ChannelTypes . GUILD_CATEGORY : return 'GuildCategoryChannel' ; case ChannelTypes . GUILD_NEWS : return 'GuildNewsChannel' ; case ChannelTypes . GUILD_NEWS_THREAD : return 'GuildNewsThreadChannel' ; case ChannelTypes . GUILD_PRIVATE_THREAD : case ChannelTypes . GUILD_PUBLIC_THREAD : return 'GuildThreadChannel' ; case ChannelTypes . GUILD_STAGE_VOICE : case ChannelTypes . GUILD_STORE : return 'AbstractChannel' ; case ChannelTypes . GUILD_TEXT : return 'GuildTextChannel' ; case ChannelTypes . GUILD_VOICE : default : return 'AbstractChannel' ; } } export function reactionEmojiEntityKey ( data ) { if ( data . id ) return 'GuildEmoji' ; return 'ReactionEmoji' ; } export function emojiEntityKey ( data ) { if ( data ?. reactionMessageId ) { return 'ReactionEmoji' ; } if ( data . roles ) { return 'GuildEmoji' ; } if ( data . id ) { return 'GuildPreviewEmoji' ; } return data . name ? 'ActivityEmoji' : 'AbstractEmoji' ; }