2017-02-07 21:36:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2017-03-22 11:18:07 +00:00
|
|
|
import bottools.methods, logging, setuptools, telegram.ext
|
2017-02-07 21:36:31 +00:00
|
|
|
|
2017-02-07 22:11:59 +00:00
|
|
|
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
|
2017-02-08 13:58:09 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
def log(bot, update, error):
|
|
|
|
logger.warn("Error %s caused by '%s'" % (error, update))
|
2017-02-07 22:11:59 +00:00
|
|
|
|
2017-03-18 18:23:38 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
updater = telegram.ext.Updater(token=setuptools.token())
|
|
|
|
|
2017-03-22 00:53:51 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("auth", bottools.methods.auth))
|
2017-03-23 17:37:01 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("broadcast", bottools.methods.broadcast, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("emergency", bottools.methods.emergency, pass_args=True))
|
2017-03-22 00:53:51 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("fish", bottools.methods.fish))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("follow", bottools.methods.follow, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("help", bottools.methods.start))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("like", bottools.methods.like, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("login", bottools.methods.auth))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("logout", bottools.methods.unauth))
|
2017-03-23 16:01:05 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("mentionstream", bottools.methods.mentionstream))
|
2017-03-22 00:53:51 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("reply", bottools.methods.reply, pass_args=True))
|
2017-03-23 12:05:48 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("restart", bottools.methods.restart))
|
2017-03-22 00:53:51 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("retweet", bottools.methods.retweet, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", bottools.methods.start))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("timeline", bottools.methods.timeline, pass_args=True))
|
2017-03-23 17:14:22 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("togglebroadcasts", bottools.methods.togglebroadcasts))
|
2017-03-23 16:01:05 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("togglementions", bottools.methods.mentionstream))
|
2017-03-23 17:14:22 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("toggletweet", bottools.methods.toggleTweet))
|
2017-03-22 00:53:51 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("tweet", bottools.methods.explicitTweet, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("unauth", bottools.methods.unauth))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("unfollow", bottools.methods.unfollow, pass_args=True))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("verify", bottools.methods.verify, pass_args=True))
|
|
|
|
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.text, bottools.methods.tweet))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.photo, bottools.methods.tweet))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.sticker, bottools.methods.tweet))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.video, bottools.methods.tweet))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.command, bottools.methods.unknown))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.document, bottools.methods.tweet))
|
2017-02-08 13:58:09 +00:00
|
|
|
|
2017-03-18 18:23:38 +00:00
|
|
|
updater.dispatcher.add_error_handler(log)
|
2017-02-07 21:54:22 +00:00
|
|
|
|
2017-03-18 18:23:38 +00:00
|
|
|
updater.start_polling()
|
|
|
|
updater.idle()
|