-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
31 lines (27 loc) · 911 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import toml
import sqlitedict
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
exclude = 0 # role id to exclude from activity checks
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()
db = sqlitedict.SqliteDict(config["db"], tablename=str(config["guild"]), autocommit=True)