def send_typed_media(resource_path, bot, channel):
    """Send file as bytes by `resource_path`.
    Send type based on file extension."""
    ext = resource_path.suffix.lower()
    media_resource = open(resource_path, 'rb')

    if ext in ('.jpeg', '.jpg', '.png'):
        return bot.send_photo(chat_id=channel, photo=media_resource)
    elif ext in ('.mp4', '.mov', '.gif', '.webp'):
        return bot.send_animation(chat_id=channel, animation=media_resource)