Created
December 6, 2016 10:07
-
-
Save makiftasova/6e5e0a777cd367c82708bcc04761344e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import asyncio | |
import telepot | |
import telepot.aio | |
class MarkdownBot(telepot.aio.Bot): | |
async def handle(self, msg): | |
flavor = telepot.flavor(msg) | |
if 'chat' == flavor: | |
chat_id = msg['chat']['id'] | |
await bot.sendMessage(chat_id, msg['text'], parse_mode='markdown') | |
TOKEN = "BOT_API_KEY" # get token from command-line | |
bot = MarkdownBot(TOKEN) | |
loop = asyncio.get_event_loop() | |
loop.create_task(bot.message_loop()) | |
print('Listening ...') | |
loop.run_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment