I am using Pyrogram to make a Telegram bot that scrapes a group chat and collects multiple messages from it.
The bot works fine on chats where there's no threads. I also want it to be able to pick messages from one specific topic exclusively if need be. Yet the bot seems to ignore the subdivision in a chat and picks messages from every topic and sends the response to General.
I tried invoking GetForumTopics and GetForumTopicsByID, but got errors saying bots can't use these.
Is there a way to extract information about topics in a chat in Pyrogram, that's available to bots?
Hello! Tell me what kind of Pyrogram you use, for example Official or Fork? If official, I recommend taking a closer look at the Fork https://github.com/KurimuzonAkuma/pyrogram, since the official Pyrogram is not updated, but this fork receives constant updates.
Just in this fork, in the Message class there is an argument Topic (Class ForumTopic) and message_thread_id. Using them you can make a filter that will filter messages as you need.
I don't know for sure if this option will work for you, but in the Official Pyrogram for the 2.0.0 release there is no way to get information about the Topic directly from the message. Of course, you can install the latest official version from GitHub, but as far as I know, it does not have such functionality.