From e391b138e5cc6462ebd80730001f139c2228a34c Mon Sep 17 00:00:00 2001 From: Milka64 Date: Tue, 5 Jan 2021 19:41:08 +0100 Subject: [PATCH] add config file in args --- kabot/kabot/kabot.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index 867632b..0ba0ec5 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -15,6 +15,7 @@ import random import requests import youtube_dl import configparser +import argparse from bs4 import BeautifulSoup as bs from discord.ext import tasks, commands @@ -540,8 +541,16 @@ def get_word(word_type): #Le do[main]e de Kabot. def main(): 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.read('config.ini') + config.read(args.config) audio_path = config['DEFAULT']['audio_path'] token = config['discord']['token'] gl_url = config['gitlab']['url']