Skip to content

Instantly share code, notes, and snippets.

@makiftasova
Created December 6, 2016 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makiftasova/6e5e0a777cd367c82708bcc04761344e to your computer and use it in GitHub Desktop.
Save makiftasova/6e5e0a777cd367c82708bcc04761344e to your computer and use it in GitHub Desktop.
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