IRC Bot package #83
1 changed files with 7 additions and 2 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue