25 lines
872 B
Python
Executable file
25 lines
872 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import dbtools, logging, setuptools, strings, telegram.ext
|
|
|
|
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
|
|
|
|
updater = telegram.ext.Updater(token=setuptools.token())
|
|
|
|
def start(bot, update):
|
|
bot.sendMessage(chat_id=update.message.chat_id, text=strings.start % (setuptools.botname, setuptools.botname))
|
|
|
|
def auth(bot, update):
|
|
bot.sendMessage(chat_id=update.message.chat_id, text="Ooops. Not implemented yet.")
|
|
|
|
def unauth(bot, update):
|
|
dbtools.deleteUser(update.message.chat_id)
|
|
bot.sendMessage(chat_id=update.message.chat_id, text=strings.unauth % setuptools.url)
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", start))
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("auth", auth))
|
|
|
|
try:
|
|
updater.start_polling()
|
|
except KeyboardInterrupt:
|
|
updater.stop()
|