Skip to content

Instantly share code, notes, and snippets.

@lincerely
Created May 9, 2017 09:05
Show Gist options
  • Save lincerely/46abd2a306dce19442fa47b2ca187f10 to your computer and use it in GitHub Desktop.
Save lincerely/46abd2a306dce19442fa47b2ca187f10 to your computer and use it in GitHub Desktop.
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from spell import *
updater = Updater(token="")
dispatcher = updater.dispatcher
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
def start(bot, update):
bot.send_photo(chat_id=update.message.chat_id,
photo=open('halt.jpg', 'rb'))
def inspection(bot, update):
for word in update.message.text.split():
word = filter(unicode.isalpha, word)
corr = correction(word.lower())
if corr != word.lower():
reply = '*'+corr
bot.send_message(chat_id=update.message.chat_id, text=reply, reply_to_message_id=update.message.message_id)
start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)
inspection_handler = MessageHandler(Filters.text, inspection)
dispatcher.add_handler(inspection_handler)
#start listening for event
updater.start_polling()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment