diff --git a/.gitignore b/.gitignore index 388bdf0..960a84d 100644 --- a/.gitignore +++ b/.gitignore @@ -182,3 +182,4 @@ cython_debug/ # Custom stuff gacha_game.db +config.ini diff --git a/bot/config.py b/bot/config.py index 408cb53..475aab9 100644 --- a/bot/config.py +++ b/bot/config.py @@ -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'] diff --git a/example_config.ini b/example_config.ini new file mode 100644 index 0000000..fe18f06 --- /dev/null +++ b/example_config.ini @@ -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']