Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forum_topic_created, forum_topic_closed, forum_topic_reopened do not work #493

Open
Anderson2000 opened this issue Dec 7, 2024 · 0 comments

Comments

@Anderson2000
Copy link

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])); } } } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant