mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
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:
|
if 'register' == args:
|
||||||
return {
|
return {
|
||||||
'name': 'plugin',
|
'name': 'plugin',
|
||||||
'desc': 'disables or re-enables plugins',
|
'desc': "'disable' or 'enable' plugins",
|
||||||
'args': ('argv0', 'argv1', 'argv2', 'reply_user'),
|
'args': ('argv0', 'argv1', 'reply_user'),
|
||||||
'is_enabled': True,
|
'is_enabled': True,
|
||||||
'ratelimit_class': RATE_GLOBAL
|
'ratelimit_class': RATE_GLOBAL
|
||||||
}
|
}
|
||||||
|
|
||||||
if 'plugin' != args['argv0']:
|
command = args['argv0']
|
||||||
|
plugin = args['argv1']
|
||||||
|
|
||||||
|
if not command in ('enable', 'disable'):
|
||||||
return
|
return
|
||||||
|
|
||||||
command = args['argv1']
|
|
||||||
plugin = args['argv2']
|
|
||||||
|
|
||||||
logger('plugin', 'plugin activation plugin called')
|
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:
|
if None == plugin:
|
||||||
return {
|
return {
|
||||||
'msg': args['reply_user'] + ': no plugin given'
|
'msg': args['reply_user'] + ': no plugin given'
|
||||||
@@ -665,7 +659,6 @@ def command_plugin_activation(args):
|
|||||||
'msg': args['reply_user'] + ': not allowed'
|
'msg': args['reply_user'] + ': not allowed'
|
||||||
}
|
}
|
||||||
|
|
||||||
if command in ('enable', 'disable'):
|
|
||||||
for i, c in enumerate(plugins['command']):
|
for i, c in enumerate(plugins['command']):
|
||||||
if c['name'] == plugin:
|
if c['name'] == plugin:
|
||||||
plugins['command'][i]['is_enabled'] = \
|
plugins['command'][i]['is_enabled'] = \
|
||||||
@@ -681,10 +674,6 @@ def command_plugin_activation(args):
|
|||||||
'msg': args['reply_user'] + ': unknown plugin %s' % plugin
|
'msg': args['reply_user'] + ': unknown plugin %s' % plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
'msg': args['reply_user'] + ': dummy plugin called'
|
|
||||||
}
|
|
||||||
|
|
||||||
#def command_dummy(args):
|
#def command_dummy(args):
|
||||||
# if 'register' == args:
|
# if 'register' == args:
|
||||||
# return {
|
# return {
|
||||||
|
|||||||
Reference in New Issue
Block a user