add config file in args

This commit is contained in:
Milka64 2021-01-05 19:41:08 +01:00
parent 1861f39450
commit e391b138e5

View file

@ -15,6 +15,7 @@ import random
import requests import requests
import youtube_dl import youtube_dl
import configparser import configparser
import argparse
from bs4 import BeautifulSoup as bs from bs4 import BeautifulSoup as bs
from discord.ext import tasks, commands from discord.ext import tasks, commands
@ -540,8 +541,16 @@ def get_word(word_type):
#Le do[main]e de Kabot. #Le do[main]e de Kabot.
def main(): def main():
logger.info("Initialisation de Kabot") logger.info("Initialisation de Kabot")
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",
"--config",
help="config file",
default="config.ini"
)
args = parser.parse_args()
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('config.ini') config.read(args.config)
audio_path = config['DEFAULT']['audio_path'] audio_path = config['DEFAULT']['audio_path']
token = config['discord']['token'] token = config['discord']['token']
gl_url = config['gitlab']['url'] gl_url = config['gitlab']['url']