rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.69k stars 1.19k forks source link

Get all users from Bot #1341

Closed Elias177Dev closed 5 months ago

Elias177Dev commented 6 months ago

Hey,

currently i try to code a TelegramBot with the Java API. I want to send a broadcast Message to all users, but how?

Does anyone know how i can get a list of users, who send the Bot a message? (User who have a open conversation with the bot)

WildTigerrr commented 6 months ago

The only way is to store each user in DB (or somewhere). Telegram doesn't provide this information

Elias177Dev commented 6 months ago

Okay, but it would be enough to save the username and chat id in the database, wouldn't it? So I can then write to the user again with?

Chase22 commented 5 months ago

Yes that will be enough. Just make sure to throttle your bot when doing broadcasts