2018-06-13 00:16:19 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
# World Time, a Discord bot. Displays user time zones.
|
2019-12-27 03:33:40 +00:00
|
|
|
# - https://github.com/NoiTheCat/WorldTime
|
2018-06-13 00:16:19 +00:00
|
|
|
# - https://bots.discord.pw/bots/447266583459528715
|
|
|
|
|
2018-08-24 20:27:56 +00:00
|
|
|
# Dependencies (install via pip or other means):
|
2019-09-07 20:03:30 +00:00
|
|
|
# pytz, psycopg2, discord.py
|
|
|
|
# How to install the latter: pip install -U git+https://github.com/Rapptz/discord.py
|
2018-06-13 00:16:19 +00:00
|
|
|
|
2021-04-22 19:20:30 +00:00
|
|
|
from discord import Intents
|
2018-08-24 05:00:40 +00:00
|
|
|
from client import WorldTime
|
2018-08-02 00:40:41 +00:00
|
|
|
import settings
|
2019-12-27 03:33:40 +00:00
|
|
|
import common
|
2018-06-13 00:16:19 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-12-27 03:33:40 +00:00
|
|
|
common.logPrint("World Time", "World Time v" + common.BotVersion)
|
|
|
|
|
2018-06-13 00:16:19 +00:00
|
|
|
try:
|
2019-12-27 03:33:40 +00:00
|
|
|
# Raising AttributeError here to cover either: variable doesn't exist, or variable is empty
|
|
|
|
if settings.BotToken == '': raise AttributeError()
|
2018-08-02 00:40:41 +00:00
|
|
|
except AttributeError:
|
|
|
|
print("Bot token not set. Will not continue.")
|
2018-06-13 00:16:19 +00:00
|
|
|
exit()
|
|
|
|
|
2019-12-27 03:33:40 +00:00
|
|
|
# todo: sharding options handled here: pass shard_id and shard_count parameters
|
2021-04-22 19:20:30 +00:00
|
|
|
subscribedIntents = Intents.none()
|
|
|
|
subscribedIntents.guilds = True
|
|
|
|
subscribedIntents.members = True
|
|
|
|
subscribedIntents.guild_messages = True
|
2019-12-27 03:33:40 +00:00
|
|
|
client = WorldTime(
|
|
|
|
max_messages=None,
|
2021-04-22 19:20:30 +00:00
|
|
|
intents = subscribedIntents
|
2019-12-27 03:33:40 +00:00
|
|
|
)
|
|
|
|
|
2018-08-02 00:40:41 +00:00
|
|
|
client.run(settings.BotToken)
|