示例#1
0
文件: bot.py 项目: MeGaTG/pybot
def on_binlog_replay_end():
    global started
    started = True
    config = load_config()
    utils.save_cfg_settings(config)
    handle_sudoers(config)
    utils.load_enabled_plugins()
    cron_plugins()
示例#2
0
def on_binlog_replay_end():
    global started
    started = True
    config = load_config()
    utils.save_cfg_settings(config)
    handle_sudoers(config)
    utils.load_enabled_plugins()
    cron_plugins()
示例#3
0
def disable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    cfg, data = getOrElse("disabled_plugins_on_chat", dict)
    plgs = data.get(receiver) or set()
    plgs.add(name)
    data[receiver] = plgs
    generic_cfg(data, "update", dict, field="disabled_plugins_on_chat")
    print("Disabled plugin {} in chat {} and saved".format(name, receiver))
    cfg["disabled_plugins_on_chat"] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} disabled in the chat {}".format(name, utils.emojis["wut"])
示例#4
0
def disable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    cfg, data = getOrElse('disabled_plugins_on_chat', dict)
    plgs = data.get(receiver) or set()
    plgs.add(name)
    data[receiver] = plgs
    generic_cfg(data, 'update', dict, field='disabled_plugins_on_chat')
    print("Disabled plugin {} in chat {} and saved".format(name, receiver))
    cfg['disabled_plugins_on_chat'] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} disabled in the chat {}".format(name,
                                                      utils.emojis['wut'])
示例#5
0
def enable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    if not utils.is_plugin_disabled_on_chat(name, receiver):
        return "Plugin {} is not disabled in this chat".format(name)
    cfg, data = getOrElse("disabled_plugins_on_chat", dict)
    plgs = data.get(receiver)
    plgs.remove(name)
    data[receiver] = plgs
    generic_cfg(data, "update", dict, field="disabled_plugins_on_chat")
    print("Enabled plugin {} in chat {} and saved".format(name, receiver))
    cfg["disabled_plugins_on_chat"] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} enabled in the chat again! {}".format(name, utils.emojis["smile"])
示例#6
0
def enable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    if not utils.is_plugin_disabled_on_chat(name, receiver):
        return 'Plugin {} is not disabled in this chat'.format(name)
    cfg, data = getOrElse('disabled_plugins_on_chat', dict)
    plgs = data.get(receiver)
    plgs.remove(name)
    data[receiver] = plgs
    generic_cfg(data, 'update', dict, field='disabled_plugins_on_chat')
    print("Enabled plugin {} in chat {} and saved".format(name, receiver))
    cfg['disabled_plugins_on_chat'] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} enabled in the chat again! {}".format(
        name, utils.emojis['smile'])