juju/bot.py

33 lines
896 B
Python

#!/usr/bin/env python3
import json
import sys
import pinhook.bot
with open('config.json') as c:
config = json.load(c)
if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] == '--test-mode':
channels = config['test']['channels']
cmd_prefix = config['test']['cmd_prefix']
nick = f"{config['nickname']}{config['test']['nick_suffix']}"
prefix_plugins = True
else:
channels = config['channels']
cmd_prefix = config['cmd_prefix']
nick = config['nickname']
prefix_plugins = False
bot = pinhook.bot.Bot(
channels,
nick,
'localhost',
ops=config['ops'],
ns_pass=f"{config['nickname']} {config['password']}",
#ns_pass=config['password'],
nickserv='nickserv',
cmd_prefix=cmd_prefix,
use_prefix_for_plugins=prefix_plugins
)
bot.start()