Skip to content

Instantly share code, notes, and snippets.

@nejni-marji
Created August 10, 2016 11:41
Show Gist options
  • Save nejni-marji/d3800b4398c615277cdaa090ac4e0c75 to your computer and use it in GitHub Desktop.
Save nejni-marji/d3800b4398c615277cdaa090ac4e0c75 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re
import telegram as tg
import telegram.ext as tg_ext
def bang(bot, update):
print('bang')
text = update.message.text
bang = re.match('![a-zA-Z0-9]*', text).group()[1:]
resp = 'You used the bang: `{}`'.format(bang)
bot.sendMessage(update.message.chat_id, resp)
def fwd(bot, update):
print('fwd')
def main(dp):
dp.add_handler(tg_ext.MessageHandler([tg_ext.Filters.text], bang))
dp.add_handler(tg_ext.MessageHandler([tg_ext.Filters.text], fwd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment