Only set webhook if __main__

This commit is contained in:
Derek Schmidt 2018-06-26 20:37:50 +00:00
parent 08a45dcd8a
commit 51b7d057e9
Signed by: skeh
GPG key ID: 0F5D491793B4035A

View file

@ -15,9 +15,6 @@ db.app = app
db.init_app(app)
bot = telebot.TeleBot(config['bot']['token'], threaded=False)
bot.remove_webhook()
time.sleep(0.1)
bot.set_webhook(url='https://{base}/{key}/'.format(base=app.config['bot']['base_url'], key=app.config['bot']['token']))
def channel_commands(message, commands):
@ -69,4 +66,8 @@ def webhook(key):
if __name__ == '__main__':
bot.remove_webhook()
time.sleep(0.1)
bot.set_webhook(url='https://{base}/{key}/'.format(base=app.config['bot']['base_url'], key=app.config['bot']['token']))
app.run()