protected static function detectType(array $data)
    {
        foreach ([
             self::TYPE_MESSAGE,
             self::TYPE_EDITED_MESSAGE,
             self::TYPE_CHANNEL_POST,
             self::TYPE_EDITED_CHANNEL_POST,
             self::TYPE_INLINE_QUERY,
             self::TYPE_CHOSEN_INLINE_RESULT,
             self::TYPE_CALLBACK_QUERY,
         ] as $type) {
            if (isset($data[$type])) {
                return $type;
            }
        }
        return static::TYPE_UNKNOWN;
    }