WorldTime/worldtime.py

37 lines
1.1 KiB
Python
Raw Normal View History

2018-06-13 00:16:19 +00:00
#!/usr/bin/env python3
# World Time, a Discord bot. Displays user time zones.
# - https://github.com/NoiTheCat/WorldTime
2018-06-13 00:16:19 +00:00
# - https://bots.discord.pw/bots/447266583459528715
# 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
import settings
import common
2018-06-13 00:16:19 +00:00
if __name__ == '__main__':
common.logPrint("World Time", "World Time v" + common.BotVersion)
2018-06-13 00:16:19 +00:00
try:
# Raising AttributeError here to cover either: variable doesn't exist, or variable is empty
if settings.BotToken == '': raise AttributeError()
except AttributeError:
print("Bot token not set. Will not continue.")
2018-06-13 00:16:19 +00:00
exit()
# 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
client = WorldTime(
max_messages=None,
2021-04-22 19:20:30 +00:00
intents = subscribedIntents
)
client.run(settings.BotToken)