mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-10 20:22:36 +01:00
Support for new module-level configuration.
This commit is contained in:
parent
6305958784
commit
a07136b07f
@ -53,7 +53,7 @@ def configure(onStart, afterConnect):
|
|||||||
# afterConnect are both lists. Append to onStart the commands you would
|
# afterConnect are both lists. Append to onStart the commands you would
|
||||||
# like to be run when the bot is started; append to afterConnect the
|
# like to be run when the bot is started; append to afterConnect the
|
||||||
# commands you would like to be run when the bot has finished connecting.
|
# commands you would like to be run when the bot has finished connecting.
|
||||||
from questions import *
|
from questions import expect, anything, something, yn
|
||||||
onStart.append('load %s')
|
onStart.append('load %s')
|
||||||
|
|
||||||
class %s(%s):
|
class %s(%s):
|
||||||
|
@ -85,11 +85,14 @@ if __name__ == '__main__':
|
|||||||
ident = anything('What ident would you like the bot to use?')
|
ident = anything('What ident would you like the bot to use?')
|
||||||
configfd.write('Ident: %s\n' % ident)
|
configfd.write('Ident: %s\n' % ident)
|
||||||
configfd.write('\n')
|
configfd.write('\n')
|
||||||
configfd.write('# Commands to run before connecting.\n')
|
onStart = []
|
||||||
configfd.write('load AdminCommands\n')
|
onStart.append('# Commands to run before connecting.')
|
||||||
configfd.write('load UserCommands\n')
|
onStart.append('load AdminCommands')
|
||||||
configfd.write('load ChannelCommands\n')
|
onStart.append('load UserCommands')
|
||||||
configfd.write('load MiscCommands\n')
|
onStart.append('load ChannelCommands')
|
||||||
|
onStart.append('load MiscCommands')
|
||||||
|
afterConnect = []
|
||||||
|
afterConnect.append('# Commands to run after connecting.')
|
||||||
|
|
||||||
###
|
###
|
||||||
# Modules.
|
# Modules.
|
||||||
@ -108,7 +111,10 @@ if __name__ == '__main__':
|
|||||||
module = imp.load_module(plugin, *moduleInfo)
|
module = imp.load_module(plugin, *moduleInfo)
|
||||||
print module.__doc__
|
print module.__doc__
|
||||||
if yn('Would you like to add this plugin?') == 'y':
|
if yn('Would you like to add this plugin?') == 'y':
|
||||||
configfd.write('load %s\n' % plugin)
|
if hasattr(module, 'configure'):
|
||||||
|
module.configure(onStart, afterConnect, advanced)
|
||||||
|
else:
|
||||||
|
onStart.append('load %s' % plugin)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Commands
|
# Commands
|
||||||
@ -118,19 +124,22 @@ if __name__ == '__main__':
|
|||||||
while advanced and yn(preConnect) == 'y':
|
while advanced and yn(preConnect) == 'y':
|
||||||
preConnect = 'Would you like any other commands ' \
|
preConnect = 'Would you like any other commands ' \
|
||||||
'to run before the bot connects to the server?'
|
'to run before the bot connects to the server?'
|
||||||
configfd.write(anything('What command?'))
|
onStart.append(anything('What command?'))
|
||||||
configfd.write('\n')
|
|
||||||
configfd.write('\n')
|
|
||||||
configfd.write('# Commands to run after the bot is connected.\n')
|
|
||||||
if yn('Do you want the bot to join any channels?') == 'y':
|
if yn('Do you want the bot to join any channels?') == 'y':
|
||||||
channels = anything('What channels? (separate channels by spaces)')
|
channels = anything('What channels? (separate channels by spaces)')
|
||||||
configfd.write('join %s\n' % channels)
|
afterConnect.append('join %s' % channels)
|
||||||
postConnect = 'Would you like any commands to run ' \
|
postConnect = 'Would you like any commands to run ' \
|
||||||
'when the bot is finished connecting to the server?'
|
'when the bot is finished connecting to the server?'
|
||||||
while advanced and yn(postConnect) == 'y':
|
while advanced and yn(postConnect) == 'y':
|
||||||
postConnect = 'Would you like any other commands to run ' \
|
postConnect = 'Would you like any other commands to run ' \
|
||||||
'when the bot is finished connecting to the server?'
|
'when the bot is finished connecting to the server?'
|
||||||
configfd.write(anything('What command?'))
|
afterConnect.append(anything('What command?'))
|
||||||
|
for command in onStart:
|
||||||
|
configfd.write(command)
|
||||||
|
configfd.write('\n')
|
||||||
|
configfd.write('\n')
|
||||||
|
for command in afterConnect:
|
||||||
|
configfd.write(command)
|
||||||
configfd.write('\n')
|
configfd.write('\n')
|
||||||
configfd.close()
|
configfd.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user