2017-02-07 21:36:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2017-03-22 00:53:51 +00:00
|
|
|
import ast, bottools.methods, dbtools, html, io, logging, moviepy.editor, PIL.Image, random, setuptools, string, bottools.strings, telegram.ext, twitools, urllib.request, tweepy
|
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))
|
|
|
|
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))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("reply", bottools.methods.reply, pass_args=True))
|
|
|
|
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))
|
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("toggletweet", bottools.methods.toggleTweet))
|
|
|
|
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()
|