def channel_factory(data: ChannelPayload, state: State) -> Channel:
    if (data['channel_type'] == 'SavedMessage'):
        return SavedMessageChannel(data, state)
    elif (data['channel_type'] == 'DirectMessage'):
        return DMChannel(data, state)
    elif (data['channel_type'] == 'Group'):
        return GroupDMChannel(data, state)
    elif (data['channel_type'] == 'TextChannel'):
        return TextChannel(data, state)
    elif (data['channel_type'] == 'VoiceChannel'):
        return VoiceChannel(data, state)
    else:
        raise Exception
def channel_factory(data: ChannelPayload, state: State) -> Channel:
    if (data['channel_type'] == 'SavedMessage'):
        return SavedMessageChannel(data, state)
    elif (data['channel_type'] == 'DirectMessage'):
        return DMChannel(data, state)
    elif (data['channel_type'] == 'Group'):
        return GroupDMChannel(data, state)
    elif (data['channel_type'] == 'TextChannel'):
        return TextChannel(data, state)
    elif (data['channel_type'] == 'VoiceChannel'):
        return VoiceChannel(data, state)
    else:
        raise Exception