Skip to content

forum_topic_created, forum_topic_closed, forum_topic_reopened do not work #493

@Anderson2000

Description

@Anderson2000

Telegram API sends an empty object ({}) in JSON for the properties forum_topic_created, forum_topic_closed, and forum_topic_reopened when creating, closing, or reopening a topic. This causes the current implementation to ignore these events.

Proposed Fix
Update the map method as follows:

Old Code:
public function map($data) { foreach (static::$map as $key => $item) { if (isset($data[$key]) && (!is_array($data[$key]) || !empty($data[$key]))) { $method = 'set' . self::toCamelCase($key); if ($item === true) { $this->$method($data[$key]); } else { $this->$method($item::fromResponse($data[$key])); } } } }

New Code:
public function map($data) { foreach (static::$map as $key => $item) { if (isset($data[$key]) && !is_null($data[$key]) && $data[$key] !== '') { $method = 'set' . self::toCamelCase($key); if ($item === true) { $this->$method($data[$key]); } else { $this->$method($item::fromResponse($data[$key])); } } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions