I cannot get_dialogs with Telethon Bot since the method is only available for a client. Therefore when I try to access the entity with its id I receive an error. How do I access an entity(channel) if I cannot parse all channels and neither access them by id? I would like to parse messages from a private group and use Telegram Bot for it.
Advertisement
Answer
Adding the bot to the channel while it’s running should be enough for the bot to obtain its access hash. Alternatively, sending a message there while the bot is inside should also work. This hash will be saved to the .session
file. Regardless, if you use the “marked” ID (for channels, prefix -100 to the real ID or use types.PeerChannel(real id)
), Telethon will know you mean a channel, which can help make it work.