1
0
Fork 0
forked from waifu/kemoverse

Move config to ini file

This commit is contained in:
VD15 2025-05-18 10:38:59 +01:00
parent 979e15f525
commit 5cc2ea2267
3 changed files with 33 additions and 7 deletions

1
.gitignore vendored
View file

@ -182,3 +182,4 @@ cython_debug/
# Custom stuff
gacha_game.db
config.ini

View file

@ -1,8 +1,19 @@
# Essential for the bot to function
INSTANCE = "" # Bots Misskey instance's URL **with schema**
KEY = "" # API key for the bot
'''Essentials for the bot to function'''
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
# Extra stuff for control of the bot
ADMINS = [] # Fedi handles in the traditional 'user@domain.tld' style,
# allows these users to use extra admin exclusive commands
# with the bot
# Username for the bot
USER = config['application']['BotUser']
# API key for the bot
KEY = config['application']['ApiKey']
# Bot's Misskey instance URL
INSTANCE = config['application']['InstanceUrl']
# Extra stuff for control of the bot
# TODO: move this to db
# Fedi handles in the traditional 'user@domain.tld' style, allows these users
# to use extra admin exclusive commands with the bot'''
ADMINS = config['application']['DefaultAdmins']

14
example_config.ini Normal file
View file

@ -0,0 +1,14 @@
; Rename me to config.ini and put your values in here
[application]
; Full fedi handle of the bot user
BotUser = @bot@example.tld
; API key for the bot
; Generate one by going to Settings > API > Generate access token
ApiKey = abcdefghijklmnopqrstuvwxyz012345
; Fully qualified URL of the instance hosting the bot
InstanceUrl = http://example.tld
; Comma separated list of fedi handles for any administrator users
DefaultAdmins = ['admin@example.tld']