An open API service indexing awesome lists of open source software.

https://github.com/qweeze/telegram-bot-wrapper


https://github.com/qweeze/telegram-bot-wrapper

Last synced: 11 months ago
JSON representation

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()
```


screenshot