diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Config.py | 8 | ||||
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | bot.conf.example | 23 | ||||
| -rw-r--r-- | bot.json.example | 21 |
5 files changed, 31 insertions, 27 deletions
@@ -63,5 +63,5 @@ target/ # custom *.db -*.json +*.conf modules/nongit-*.py @@ -1,7 +1,7 @@ -import json, os +import configparser, os class Config(object): - def __init__(self, bot, location="bot.json"): + def __init__(self, bot, location="bot.conf"): self.bot = bot self.location = location self.full_location = os.path.join(bot.bot_directory, @@ -12,4 +12,6 @@ class Config(object): def load_config(self): if os.path.isfile(self.full_location): with open(self.full_location) as config_file: - self.bot.config = json.loads(config_file.read()) + parser = configparser.ConfigParser() + parser.read_string(config_file.read()) + self.bot.config = dict(parser["bot"].items()) @@ -8,10 +8,10 @@ Python3 event-driven modular IRC bot! * [suds](https://pypi.python.org/pypi/suds-jurko) ## Configurating -To get BitBot off the ground, there's some API-keys and the like in bot.json.example. move it to bot.json, fill in the API keys you want (and remove the ones you don't want - this will automatically disable the modules that rely on them.) +To get BitBot off the ground, there's some API-keys and the like in bot.conf.example. move it to bot.conf, fill in the API keys you want (and remove the ones you don't want - this will automatically disable the modules that rely on them.) ## Eagle -BitBot's National Rail module can optionally include output from Network Rail's SCHEDULE via [Eagle](https://github.com/EvelynSubarrow/Eagle). Configuration on BitBot's end is covered by the `eagle-` keys in bot.json.example. +BitBot's National Rail module can optionally include output from Network Rail's SCHEDULE via [Eagle](https://github.com/EvelynSubarrow/Eagle). Configuration on BitBot's end is covered by the `eagle-` keys in bot.conf.example. ## Running Just run `./start.py` diff --git a/bot.conf.example b/bot.conf.example new file mode 100644 index 00000000..76df4848 --- /dev/null +++ b/bot.conf.example @@ -0,0 +1,23 @@ +[bot] +openweathermap-api-key = +wolframalpha-api-key = +google-api-key = +google-search-id = +bighugethesaurus-api-key = +wordnik-api-key = +lastfm-api-key = +twitter-api-key = +twitter-api-secret = +twitter-access-token = +twitter-access-secret = +trakt-api-key = +bitly-api-key = +soundcloud-api-key = +tfl-api-id = +tfl-api-key = +nre-api-key = +eagle-api-key = +eagle-api-url = +pushbullet-api-key = +pushbullet-channel-tag = +omdbapi-api-key = diff --git a/bot.json.example b/bot.json.example deleted file mode 100644 index 14fc0dd5..00000000 --- a/bot.json.example +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openweathermap-api-key" : "", - "wolframalpha-api-key" : "", - "google-api-key" : "", - "google-search-id" : "", - "bighugethesaurus-api-key" : "", - "wordnik-api-key" : "", - "lastfm-api-key" : "", - "twitter-api-key" : "", - "twitter-api-secret" : "", - "twitter-access-token" : "", - "twitter-access-secret" : "", - "trakt-api-key" : "", - "bitly-api-key" : "", - "soundcloud-api-key" : "", - "tfl-api-id" : "", - "tfl-api-key" : "", - "eagle-api-url" : "", - "eagle-api-key" : "", - "omdbapi-api-key" : "" -} |
