Almost all options being config options
The options in the bot configuration should be taken from the config.json not from the bot source file, as hardcoding options is bad I've also refactorized the handler, and made most options be config options
parent
ad4b711a7c
commit
5fdf036a18
22
bot.py
22
bot.py
|
@ -8,28 +8,22 @@ with open('config.json') as c:
|
||||||
config = json.load(c)
|
config = json.load(c)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1 and sys.argv[1] == '--test-mode':
|
||||||
if sys.argv[1] == '--test-mode':
|
channels = config['test']['channels']
|
||||||
channels = ['#jmjl-devel']
|
cmd_prefix = config['test']['cmd_prefix']
|
||||||
nick = 'ju[dev]'
|
nick = f"{config['nickname']}{config['test']['nick_suffix']}"
|
||||||
prefix_plugins = True
|
prefix_plugins = True
|
||||||
cmd_prefix='^'
|
|
||||||
else:
|
else:
|
||||||
channels = config['channels']
|
channels = config['channels']
|
||||||
|
cmd_prefix = config['cmd_prefix']
|
||||||
|
nick = config['nickname']
|
||||||
prefix_plugins = False
|
prefix_plugins = False
|
||||||
cmd_prefix='&'
|
|
||||||
nick = 'ju'
|
|
||||||
else:
|
|
||||||
channels = config['channels']
|
|
||||||
nick = 'ju'
|
|
||||||
prefix_plugins = False
|
|
||||||
cmd_prefix='&'
|
|
||||||
bot = pinhook.bot.Bot(
|
bot = pinhook.bot.Bot(
|
||||||
channels,
|
channels,
|
||||||
nick,
|
nick,
|
||||||
'localhost',
|
'localhost',
|
||||||
ops=['jmjl'],
|
ops=config['ops'],
|
||||||
ns_pass='ju {}'.format(config['password']),
|
ns_pass=f"{config['nickname'] {config['password']}",
|
||||||
#ns_pass=config['password'],
|
#ns_pass=config['password'],
|
||||||
nickserv='nickserv',
|
nickserv='nickserv',
|
||||||
cmd_prefix=cmd_prefix,
|
cmd_prefix=cmd_prefix,
|
||||||
|
|
Loading…
Reference in New Issue