Move config to ini file

pull/8/head
VD15 2 days ago
parent 979e15f525
commit 5cc2ea2267
  1. 1
      .gitignore
  2. 27
      bot/config.py
  3. 14
      example_config.ini

1
.gitignore vendored

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

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

@ -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']
Loading…
Cancel
Save