WorldTime/start.py
Noikoio 87dda003b7 Separated settings into own file; added reporting task
This makes it easier to not have to mess with files on each git update.
Reporting code already existed in production, but the auth token is no
longer hardcoded into the function.
2018-08-01 17:40:41 -07:00

24 lines
761 B
Python

#!/usr/bin/env python3
# World Time, a Discord bot. Displays user time zones.
# - https://github.com/Noikoio/WorldTime
# - https://bots.discord.pw/bots/447266583459528715
# Using discord.py rewrite. To install:
# pip install -U git+https://github.com/Rapptz/discord.py@rewrite
# And yes, this code sucks. I don't know Python all too well.
from discord import Game
from wtclient import WorldTime
import settings
if __name__ == '__main__':
try:
if settings.BotToken == '': raise AttributeError() # Cover both scenarios: variable doesn't exist, or variable is empty
except AttributeError:
print("Bot token not set. Will not continue.")
exit()
client = WorldTime(activity=Game('tz.help'))
client.run(settings.BotToken)