Example #1
0
def disable_plugin(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    if not utils.plugin_enabled(name):
        return 'Plugin {} is not enabled'.format(name)
    generic_cfg(name, 'remove')
    print("Removed plugin {} to config file".format(name))
    utils.reload_cfg_plugins()
    return list_plugins(True, receiver)
Example #2
0
def disable_plugin(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    if not utils.plugin_enabled(name):
        return "Plugin {} is not enabled".format(name)
    generic_cfg(name, "remove")
    print("Removed plugin {} to config file".format(name))
    utils.reload_cfg_plugins()
    return list_plugins(True, receiver)
Example #3
0
def enable_plugin(name, receiver):
    print("")
    if utils.plugin_enabled(name):
        return 'Plugin {} is enabled'.format(name)
    if utils.plugin_exists(name):
        generic_cfg(name, 'append')
        print("Added plugin {} to config file".format(name))
        utils.reload_cfg_plugins()
        return list_plugins(True, receiver)
    else:
        return 'Plugin "{}" does not exists'.format(name)
Example #4
0
def enable_plugin(name, receiver):
    print("")
    if utils.plugin_enabled(name):
        return "Plugin {} is enabled".format(name)
    if utils.plugin_exists(name):
        generic_cfg(name, "append")
        print("Added plugin {} to config file".format(name))
        utils.reload_cfg_plugins()
        return list_plugins(True, receiver)
    else:
        return 'Plugin "{}" does not exists'.format(name)
Example #5
0
def help_plugin(name):
    if not utils.plugin_enabled(name):
        return "Plugin {} is not enabled, try execute \"!help\"".format(name)
    plg = settings.PLUGINS[name]
    if not hasattr(plg, '__info__'):
        return 'The plugin {} don\'t have information'.format(name)
    if not plg.__info__.get('usage'):
        return 'The plugin {} don\'t have usage info'.format(name)
    usage = plg.__info__['usage']
    if type(usage) is str:
        return usage
    elif isinstance(usage, collections.Iterable):
        return '\n'.join(usage)
    return ''
Example #6
0
def help_plugin(name):
    if not utils.plugin_enabled(name):
        return "Plugin {} is not enabled, try execute \"!help\"".format(name)
    plg = settings.PLUGINS[name]
    if not hasattr(plg, '__info__'):
        return 'The plugin {} don\'t have information'.format(name)
    if not plg.__info__.get('usage'):
        return 'The plugin {} don\'t have usage info'.format(name)
    usage = plg.__info__['usage']
    if type(usage) is str:
        return usage
    elif isinstance(usage, collections.Iterable):
        return '\n'.join(usage)
    return ''