1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-11-01 12:22:38 +00:00
watcher/config.py

32 lines
911 B
Python
Raw Normal View History

2022-06-09 01:59:15 +00:00
import toml
2022-07-05 22:19:59 +00:00
import sqlitedict
2022-06-09 01:59:15 +00:00
import hikari
# Hikari activity type
# https://www.hikari-py.dev/hikari/presences.html#hikari.presences.ActivityType
ACTIVITY = hikari.ActivityType.WATCHING
# Default bot configuration
CONFIG = """\
client = 0 # bot application id
token = "" # bot token
activity = "you" # bot status
db = "watcher.db" # sqlite3 db filepath
guild = 0 # guild id to watch
active = 0 # active role id
inactive = 0 # inactive role id
2022-06-14 23:21:49 +00:00
exclude = 0 # role id to exclude from activity checks
2022-06-09 01:59:15 +00:00
duration = 0 # time in seconds before considered inactive
"""
# Load or create config.toml
try:
config = toml.load("config.toml")
except FileNotFoundError:
with open("config.toml", "w") as f:
f.write(CONFIG)
print("config.toml created with default values. Restart when modified")
exit()
2022-07-05 22:19:59 +00:00
db = sqlitedict.SqliteDict(config["db"], tablename=str(config["guild"]), autocommit=True)