diff --git a/tts.py b/tts.py index 59b9bba..b2c0e0c 100644 --- a/tts.py +++ b/tts.py @@ -29,6 +29,7 @@ import datetime import socketserver import urllib.request import urllib.parse +import webbrowser from threading import Thread from http.server import BaseHTTPRequestHandler @@ -593,9 +594,11 @@ def main(): if conf['IRC_OAUTH_TOKEN'] == "Invalid": logging.error('No OAuth Token, skipping start of IRC bot.') - while True: - logging.error('Please open http://%s:%s/token to generate your OAuth-Token.', conf['HTTP_BIND'], conf['HTTP_PORT']) - time.sleep(10) + logging.error('Please open http://%s:%s/token to generate your OAuth-Token.', conf['HTTP_BIND'], conf['HTTP_PORT']) + url = 'http://'+str(conf['HTTP_BIND'])+':'+str(conf['HTTP_PORT'])+'/token' + webbrowser.open_new_tab(url) + logging.info('Please complete the OAuth process within the next 15 minutes.') + time.sleep(900) else: logging.info("Starting IRC bot") irc = IRC() @@ -604,6 +607,8 @@ def main(): irc.sendmsg(conf['IRC_CHANNEL'], 'MrDestructoid', conf['MESSAGE']['READY']) logging.info("Please open your browser and visit: http://%s:%s/", conf['HTTP_BIND'], conf['HTTP_PORT']) + url = 'http://'+str(conf['HTTP_BIND'])+':'+str(conf['HTTP_PORT']) + webbrowser.open_new_tab(url) while True: if conf['LOG_LEVEL'] == "DEBUG":