mv 'enable'|'disable' to own commands
This commit is contained in:
23
plugins.py
23
plugins.py
@@ -636,26 +636,20 @@ def command_plugin_activation(args):
|
||||
if 'register' == args:
|
||||
return {
|
||||
'name': 'plugin',
|
||||
'desc': 'disables or re-enables plugins',
|
||||
'args': ('argv0', 'argv1', 'argv2', 'reply_user'),
|
||||
'desc': "'disable' or 'enable' plugins",
|
||||
'args': ('argv0', 'argv1', 'reply_user'),
|
||||
'is_enabled': True,
|
||||
'ratelimit_class': RATE_GLOBAL
|
||||
}
|
||||
|
||||
if 'plugin' != args['argv0']:
|
||||
command = args['argv0']
|
||||
plugin = args['argv1']
|
||||
|
||||
if not command in ('enable', 'disable'):
|
||||
return
|
||||
|
||||
command = args['argv1']
|
||||
plugin = args['argv2']
|
||||
|
||||
logger('plugin', 'plugin activation plugin called')
|
||||
|
||||
if command in (None, 'list'):
|
||||
return {
|
||||
'msg': args['reply_user'] + ': known plugins: ' +
|
||||
str([c['name'] for c in plugins['command']])[1:-1]
|
||||
}
|
||||
|
||||
if None == plugin:
|
||||
return {
|
||||
'msg': args['reply_user'] + ': no plugin given'
|
||||
@@ -665,7 +659,6 @@ def command_plugin_activation(args):
|
||||
'msg': args['reply_user'] + ': not allowed'
|
||||
}
|
||||
|
||||
if command in ('enable', 'disable'):
|
||||
for i, c in enumerate(plugins['command']):
|
||||
if c['name'] == plugin:
|
||||
plugins['command'][i]['is_enabled'] = \
|
||||
@@ -681,10 +674,6 @@ def command_plugin_activation(args):
|
||||
'msg': args['reply_user'] + ': unknown plugin %s' % plugin
|
||||
}
|
||||
|
||||
return {
|
||||
'msg': args['reply_user'] + ': dummy plugin called'
|
||||
}
|
||||
|
||||
#def command_dummy(args):
|
||||
# if 'register' == args:
|
||||
# return {
|
||||
|
||||
Reference in New Issue
Block a user