https://github.com/qweeze/telegram-bot-wrapper
https://github.com/qweeze/telegram-bot-wrapper
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/qweeze/telegram-bot-wrapper
- Owner: qweeze
- Created: 2017-02-05T00:14:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-05T00:48:12.000Z (almost 9 years ago)
- Last Synced: 2025-01-05T12:41:53.486Z (about 1 year ago)
- Language: Python
- Size: 70.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Telegram bot wrapper
A simple backend for [Telegram messenger bots](https://core.telegram.org/bots).
Here's a minimal example of how to turn a bot into a remote shell client.
```python
import subprocess
from telebot import Client
def handler(message):
command = '{}; exit 0'.format(message)
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
if output:
answer = output.decode('utf8', errors='replace').rstrip('\n')
return '```{}```'.format(answer)
client = Client(token='your-API-token', handler=handler)
client.start()
```