rubenlagus / TelegramBots

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

Unregister/stop a bot session. #19

Closed popolony2k closed 8 years ago

popolony2k commented 8 years ago

Hi. I'm the developer of the open source instant messenger project known as PlanetaMessenger.org and I'm developing a network plugin compatible with Telegram, based on TelegramBots api.

I already have connected with the Telegram host successfully using your bot api, but now I need some way to disconnect from the telegram bot account (stop listening events maybe).

I think that there's no a disconnect or unregister a bot handler, like TelegramBotsApi.unregisterBot(). Am I right ?

If no, please tell me how can I disconnect from telegram account/server.

If disconnecting from Telegram server is not possible today, please tell me if you're planning add tome feature like this on your bot library ?

Thanks in advance.

SuperMasterBlasterLaser commented 8 years ago

@popolony2k I think placing bot handler instance to separate thread and then kill this thread when you want to unregister it is the only possible solution.

rubenlagus commented 8 years ago

@popolony2k Indeed, at the moment there is no option to disconnecting it. I'll try to make something for this, but can't promise anything.

If you can manage anything, feel free to make a pull request