IRC Bot package #83

Closed
max wants to merge 16 commits from pkg-ircbot into master
Showing only changes of commit 7a6f7b5cc0 - Show all commits

View file

@ -1,6 +1,7 @@
import os import os
import sys import sys
import justirc import justirc
import json
import importlib import importlib
class EventHandler(object): class EventHandler(object):
@ -11,7 +12,7 @@ class EventHandler(object):
... ...
def main(): def main():
config = dict( default_config = dict(
debug=False, debug=False,
nick='smith', nick='smith',
channel='#general', channel='#general',
@ -19,7 +20,11 @@ def main():
port=6697, port=6697,
tls=True, tls=True,
) )
run_bot(config) config = dict()
if (config_file := os.getenv("IRCBOT_CONFIG")) and config_file != "":
with open(config_file) as f:
config = json.load(f)
run_bot(default_config | config)
def shutdown_bot_hooks(bot): def shutdown_bot_hooks(bot):
for name, hook in bot.hooks: for name, hook in bot.hooks: