Created
August 10, 2016 11:41
-
-
Save nejni-marji/d3800b4398c615277cdaa090ac4e0c75 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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