Has anyone figured out how to properly send periodic messages

to a group with topics?

Imagine your bot sends periodic messages, therefore not generated by any update containing thread_message_id, to a group (e.g to send the leaderboard of the most active members of the group), how would you send that message?

Even if you save thread_message_id from a previous update, that topic could be closed and by bot api you have no methods to get a list of available topics (and therefore send the message to one of the available topics)

5 ответов

31 просмотр

If the topic gets closed, you receive an update, and you can act accordingly. If a topic gets deleted while the bot is offline, sendMessage will return a TOPIC_DELETED error (403)

Mr Robot- Автор вопроса
davide. φ
If the topic gets closed, you receive an update, a...

Yes, but then you don’t get a topic where your bot can write. Imagine like: - "Use this command to set where you want that the bots send notification" *Topic gets deleted* How to inform group members that the bot can’t send messages to the previously selected topic (and therefore they should select a new topic) if the bot doesn’t have a list of available topics?

I think you can use the topic_id=0

Mr Robot- Автор вопроса
davide. φ
I think you can use the topic_id=0

Interesting, I will check this, thanks

Mr Robot- Автор вопроса
davide. φ
I think you can use the topic_id=0

Checked, it must contain an existing message_thread_id or an existing reply_to_message_id, otherwise it returns Bad Request: TOPIC_DELETED"

Похожие вопросы

Карта сайта