• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python weechat.hook_completion函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中weechat.hook_completion函数的典型用法代码示例。如果您正苦于以下问题:Python hook_completion函数的具体用法?Python hook_completion怎么用?Python hook_completion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hook_completion函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():
    weechat.hook_modifier("irc_in_notice", "modifier_cb", "")
    weechat.hook_completion("bitlbee", "bitlbee completion",
                            "bitlbee_completion", "")

    weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
    weechat.hook_print('', 'irc_topic', '', 1, 'print_332', '')
    find_buffer()
开发者ID:DarkDefender,项目名称:scripts,代码行数:8,代码来源:bitlbee_completion.py


示例2: main

def main():
    """ Entry point, initializes everything  """

    weechat.register(
        SCRIPT_NAME,
        SCRIPT_AUTHOR,
        SCRIPT_VERSION,
        SCRIPT_LICENSE,
        SCRIPT_DESCRIPTION,
        "", # Shutdown callback function
        "", # Charset (blank for utf-8)
    )

    # Default values for settings
    default_settings = {
        'dbfile': os.path.join(
            weechat.info_get("weechat_dir", ""), "emojis-db.dat")
    }

    # Apply default configuration values if anything is unset
    for option, default in default_settings.items():
        if not weechat.config_is_set_plugin(option):
            weechat.config_set_plugin(option, default)

    # Hook callbacks
    weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
        "configuration_cb", "")
    weechat.hook_command_run("/input return", "transform_cb", "")
    weechat.hook_command_run("/input complete*", "complete_cb", "")
    #weechat.hook_modifier("input_text_display", "collapse_cb", "")

    # Command callbacks
    weechat.hook_command(  # command name
                           SCRIPT_NAME,
                           # description
                           " display :common_name: with its emoji equivalent",
                           # arguments
                           "reload"
                           " || add <name> <emoji>"
                           " || show <emoji>",
                           # description of arguments
                           " name: emoji name, sans colons\n"
                           "emoji: text that replaces :name:\n",
                           # completions
                           "reload || add || show %(emoji_name)", "emojis_cb", "")
    weechat.hook_completion("emoji_name", "Emoji name", "emoji_name_completion_cb", "")

    dbfile = weechat.config_get_plugin("dbfile")

    weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))

    try:
        load_emojis(dbfile)
    except IOError as e:
        weechat.prnt("",
            "%s%s: Database file %s is missing or inaccessible." \
                    % (weechat.prefix("error"), SCRIPT_NAME, dbfile))
        raise e # TODO: handle this better instead of brutally aborting
开发者ID:flowbish,项目名称:weechat-emojis,代码行数:58,代码来源:emojis.py


示例3: main

def main():
    """Main entry"""

    weechat.register(NAME, AUTHOR, VERSION, LICENSE, DESC, '', '')
    weechat.hook_completion('replacer_plugin', 'Try to match last word with '
                            'those in replacement map keys, and replace it '
                            'with value.', 'replace_cb', '')
    weechat.hook_completion('completion_cb', 'Complete replacement map keys',
                            'completion_cb', '')

    weechat.hook_command(COMMAND, DESC, "[add <word> <text>|del <word>]",
                         __doc__ % {"command": COMMAND},
                         'add|del %(completion_cb)', 'replace_cmd', '')
开发者ID:gryf,项目名称:weechat-replacer,代码行数:13,代码来源:replacer.py


示例4: main

def main():
    at_config('load')
    # hook our config
    weechat.hook_config(STRIP_VAR+'*','at_config','')
    # hook the nick complete
    weechat.hook_command_run('/input complete_next', 'at_completion', '')
    # hook the /atcomplete
    weechat.hook_command('atcomplete','manage @nick completion plugin',
        '[enable|disable|toggle] '
        ' | [servers [list | add name | del name]]'
        ' | [buffers [list | add name | del name]]',
        'args desc',
        'status %-'
        ' || enable %-'
        ' || disable %-'
        ' || toggle %-'
        ' || server list|add|del %(buffers_names)'
        ' || buffer list|add|del %(buffers_names)'
        ,
        'at_control','')
    # hook the completetion for /atcomplete
    weechat.hook_completion('plugin_at_completion','@nick completion','at_complete','')
开发者ID:WarheadsSE,项目名称:weechat-atcompletion,代码行数:22,代码来源:at_completion.py


示例5: jmh_hook_commands_and_completions

def jmh_hook_commands_and_completions():
    """ Hook commands and completions. """
    # prototype: hook = weechat.hook_command(command, description, args, args_description,
    #   completion, callback, callback_data)
    weechat.hook_command(SCRIPT_COMMAND, SCRIPT_DESC,
        "[ on | off | log | verbose [on|off]",
        "     on: enable jabber_message_handler\n"
        "    off: disable jabber_message_handler\n"
        "    log: name of events log file\n"
        "verbose: toggle verbose on/off\n"
        "\n"
        "Without an argument, current settings are displayed.\n"
        "\n"
        "Examples:\n"
        "List settings: /jabber_message_handler\n"
        "      Enable : /jabber_message_handler on\n"
        "     Disable : /jabber_message_handler off\n"
        "      Set log: /jabber_message_handler log /path/to/events.log\n"
        "   Verbose on: /jabber_message_handler verbose on\n"
        "  Verbose off: /jabber_message_handler verbose off\n",
        "log "
        " || off"
        " || on"
        " || verbose on|off",
        "jmh_cmd", "")

    weechat.hook_command('clr', 'Clear jabber events log.',
            '', "Usage: /clr", '', 'jmh_cmd_clr', '');

    weechat.hook_command('jabber_echo_message',
            'Echo message in jabber buffer.',
            '', "Usage: /jabber_echo_message server message",
            '%(jabber_servers)', 'jmh_cmd_jabber_echo_message', '');

    weechat.hook_completion("jabber_servers", "list of jabber servers",
                            "jmh_completion_servers", "")
开发者ID:zsw,项目名称:dotfiles,代码行数:36,代码来源:jabber_message_handler.py


示例6: main

def main():
    if not weechat.register('hipchat', 'Joakim Recht <[email protected]>', '1.0',
                            'MIT', 'Hipchat utilities',
                            '', ''):
        return

    rooms_set_default_settings()
    rooms_reset_stored_sort_order()
    get_token()

    weechat.hook_command(
        'hipchat', 'Hipchat utilities',
        '[rooms | autojoin | whois <user> | fullnames | nicks [<pattern>]]',
        'rooms: List rooms\nautojoin: List autojoin rooms\nwhois <user>: Get information '
        'about a specific user - either @mention or email\nfullnames: Force populate full '
        'names in nicklists in all channels\nnicks <pattern>: List users, optionally by pattern. '
        'Use * in pattern as wildcard match.\n',
        'rooms|autojoin|whois|fullnames|nicks', 'hipchat_cmd', '')
    weechat.hook_completion('hipchat_mentions', 'Mentions', 'complete_mention', '')

    if weechat.config_get_plugin('enable_fullnames') == 'on':
        nicklist_download()
    weechat.hook_signal('nicklist_nick_added', 'update_fullname_join', '')
    weechat.hook_signal('hipchat_nicks_downloaded', 'show_nicks_cb', '')
开发者ID:recht,项目名称:weechat-plugins,代码行数:24,代码来源:hipchat.py


示例7: test_hooks

def test_hooks():
    """Test function hook_command."""
    # hook_completion / hook_completion_args / and hook_command
    hook_cmplt = weechat.hook_completion('SCRIPT_NAME', 'description',
                                         'completion_cb', 'completion_data')
    hook_cmd = weechat.hook_command('cmd' + 'SCRIPT_NAME', 'description',
                                    'arguments', 'description arguments',
                                    '%(' + 'SCRIPT_NAME' + ')',
                                    'command_cb', 'command_data')
    weechat.command('', '/input insert /cmd' + 'SCRIPT_NAME' + ' w')
    weechat.command('', '/input complete_next')
    # hook_command_run
    hook_cmd_run = weechat.hook_command_run('/cmd' + 'SCRIPT_NAME' + '*',
                                            'command_run_cb', 'command_run_data')
    weechat.command('', '/input return')
    weechat.unhook(hook_cmd_run)
    weechat.unhook(hook_cmd)
    weechat.unhook(hook_cmplt)
开发者ID:weechat,项目名称:weechat,代码行数:18,代码来源:testapi.py


示例8: len

    elif len(args) == 2:
        msg = u": ".join((args[1], ftext))
    else:
        msg = ftext
    weechat.command(buffer, msg.encode("utf-8"))
    return weechat.WEECHAT_RC_OK


def command_factreload(data, buffer, args):
    """Reload factoids."""
    return load_factoids()


def kwfactoids_completion_cb(data, completion_item, buffer, completion):
    """Add completion for factoids."""
    for factoid in FACTOIDS:
        weechat.hook_completion_list_add(completion, factoid, 0, weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK

load_factoids()

weechat.hook_command("factoid", "Send a factoid to channel.", "[factoid] [user]",
                     "factoid is name of factoid, user (optional) is user to direct the factoid at.",
                     "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("f", "Send a factoid to channel.", "[factoid] [user]",
                     "factoid is name of factoid, user (optional) is user to direct the factoid at.",
                     "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("factreload", "Reload factoids.", "", "", "", "command_factreload", "")
weechat.hook_completion("kwfactoidsc", "Factoid completion", "kwfactoids_completion_cb", "")
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
开发者ID:Kwpolska,项目名称:scripts,代码行数:30,代码来源:kwfactoids.py


示例9: init_options

        weechat.hook_command(SCRIPT_NAME,SCRIPT_DESC,
                             'add <server> [<channel1>[ <channel2>...]] | [-key <channelkey> [<channelkey>...]] ||'
                             'del <server> [<channel1>[ <channel2>...]]',
                             'add <server> <channel>: add channel to irc.server.<servername>.autojoin\n'
                             '     -key <channelkey>: name of channelkey\n'
                             'del <server> <channel>: del channel from irc.server.<servername>.autojoin\n'
                             '\n'
                             'Examples:\n'
                             ' add current channel to corresponding server option:\n'
                             '  /' + SCRIPT_NAME + ' add\n'
                             ' add all channels from all server to corresponding server option:\n'
                             '  /allchan /' + SCRIPT_NAME + ' add\n'
                             ' add channel #weechat to autojoin option on server freenode:\n'
                             '  /' + SCRIPT_NAME + ' add freenode #weechat\n'
                             ' add channel #weechat and #weechat-de to autojoin option on server freenode, with channel key for channel #weechat:\n'
                             '  /' + SCRIPT_NAME + ' add freenode #weechat #weechat-de -key my_channel_key\n'
                             ' del channels #weechat and #weechat-de from autojoin option on server freenode:\n'
                             '  /' + SCRIPT_NAME + ' del freenode #weechat #weechat-de',
                             'add %(irc_servers) %(irc_server_channels)|%*||'
                             'del %(irc_servers) %(plugin_autojoinem)|%*',
                             'add_autojoin_cmd_cb', '')

        init_options()
        weechat.hook_completion('plugin_autojoinem', 'autojoin_completion', 'autojoinem_completion_cb', '')
        weechat.hook_config('plugins.var.python.' + SCRIPT_NAME + '.*', 'toggle_refresh', '')

#        if int(version) >= 0x00030600:
#        else:
#            weechat.prnt("","%s%s %s" % (weechat.prefix("error"),SCRIPT_NAME,": needs version 0.3.6 or higher"))
#            weechat.command("","/wait 1ms /python unload %s" % SCRIPT_NAME)
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:autojoinem.py


示例10: replace_emoji

    return weechat.WEECHAT_RC_OK


def replace_emoji(match):
    text = match.group(0)
    codepoint = EMOJI.get(text[1:-1])
    if codepoint:
        raw = "\\U%08x" % int(codepoint, 16)
        return raw.decode("unicode-escape").encode("utf-8")
    return text


if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
        weechat.hook_modifier("weechat_print", "interpolate_emoji_cb", "")
        weechat.hook_completion("emoji_names", "complete colon :emoji:", "emoji_completion_cb", "")


# Emoji mapping is modified from
# https://github.com/iamcal/emoji-data/blob/master/emoji.json
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Cal Henderson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
开发者ID:kattrali,项目名称:weemoji,代码行数:31,代码来源:weemoji.py


示例11: docgen_completion_cb

                               num_files_updated['hdata'],
                               num_files_updated['completions']))
    weechat.prnt('',
                 'docgen: total: {0} files, {1} updated'
                 ''.format(num_files['total2'], num_files_updated['total2']))
    return weechat.WEECHAT_RC_OK


def docgen_completion_cb(data, completion_item, buf, completion):
    """Callback for completion."""
    for locale in LOCALE_LIST:
        weechat.hook_completion_list_add(completion, locale, 0,
                                         weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK


if __name__ == '__main__' and IMPORT_OK:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
        weechat.hook_command(SCRIPT_COMMAND,
                             'Documentation generator.',
                             '[locales]',
                             'locales: list of locales to build (by default '
                             'build all locales)',
                             '%(docgen_locales)|%*',
                             'docgen_cmd_cb', '')
        weechat.hook_completion('docgen_locales', 'locales for docgen',
                                'docgen_completion_cb', '')
        if not weechat.config_is_set_plugin('path'):
            weechat.config_set_plugin('path', DEFAULT_PATH)
开发者ID:Georgiy-Tugai,项目名称:weechat,代码行数:30,代码来源:docgen.py


示例12: init_options

            "add <server> [<channel1>[ <channel2>...]] | [-key <channelkey> [<channelkey>...]] ||"
            "del <server> [<channel1>[ <channel2>...]]",
            "add <server> <channel>: add channel to irc.server.<servername>.autojoin\n"
            "     -key <channelkey>: name of channelkey\n"
            "del <server> <channel>: del channel from irc.server.<servername>.autojoin\n"
            "\n"
            "Examples:\n"
            " add current channel to corresponding server option:\n"
            "  /" + SCRIPT_NAME + " add\n"
            " add all channels from all server to corresponding server option:\n"
            "  /allchan /" + SCRIPT_NAME + " add\n"
            " add channel #weechat to autojoin option on server freenode:\n"
            "  /" + SCRIPT_NAME + " add freenode #weechat\n"
            " add channel #weechat and #weechat-de to autojoin option on server freenode, with channel key for channel #weechat:\n"
            "  /" + SCRIPT_NAME + " add freenode #weechat #weechat-de -key my_channel_key\n"
            " del channels #weechat and #weechat-de from autojoin option on server freenode:\n"
            "  /" + SCRIPT_NAME + " del freenode #weechat #weechat-de",
            "add %(irc_servers) %(irc_server_channels)|%*||" "del %(irc_servers) %(plugin_autojoinem)|%*",
            "add_autojoin_cmd_cb",
            "",
        )

        init_options()
        weechat.hook_completion("plugin_autojoinem", "autojoin_completion", "autojoinem_completion_cb", "")
        weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "toggle_refresh", "")

#        if int(version) >= 0x00030600:
#        else:
#            weechat.prnt("","%s%s %s" % (weechat.prefix("error"),SCRIPT_NAME,": needs version 0.3.6 or higher"))
#            weechat.command("","/wait 1ms /python unload %s" % SCRIPT_NAME)
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:30,代码来源:autojoinem.py


示例13: cmd_cb

def cmd_cb(data, buffer, args):
    args = args.split()
    if not args:
        return weechat.WEECHAT_RC_ERROR
    changes = get_config_json('changes')
    if args[0] == 'set':
        changes[args[1]] = args[2]
        set_config_json('changes', changes)
        weechat.prnt('', 'replacement for %s set' % args[1])
    elif args[0] == 'unset':
        del changes[args[1]]
    elif args[0] == 'list':
        weechat.prnt('', '%d replacements set:' % len(changes))
        for old, new in changes.items():
            weechat.prnt('', "  %s    %s" % (old, new))
    else:
        weechat.prnt('', 'Invalid subcommand: %s' % args[0])
        return weechat.WEECHAT_RC_ERROR
    return weechat.WEECHAT_RC_OK

weechat.hook_modifier('irc_in_privmsg', 'change_nick', '')
weechat.hook_command('nickreplacer', "Set replacement for nick",
                     '[list] | [set old new] | [unset old]',
                     'Use any subcommand',
                     'set old new'
                     'unset old',
                     'cmd_cb', '')
weechat.hook_completion('replacednicks', "Words in completion list.",
                        'complete', '')
开发者ID:boyska,项目名称:weechat-nickreplacer,代码行数:29,代码来源:nickreplacer.py


示例14:

                "highlight_words_add weechat\n"
                "  disable highlights from nick \"mike\" on freenode server, "
                "channel #weechat (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
                "hotlist_max_level_nicks_add mike:2\n"
                "  disable hotlist changes for nick \"bot\" on freenode "
                "server (all channels) (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.freenode.* "
                "hotlist_max_level_nicks_add bot:-1",
                "add %(buffers_plugins_names)|"
                "%(buffer_autoset_current_buffer) "
                "%(buffer_properties_set)"
                " || del %(buffer_autoset_options)",
                "bas_cmd", "")
            weechat.hook_completion(
                "buffer_autoset_current_buffer",
                "current buffer name for buffer_autoset",
                "bas_completion_current_buffer_cb", "")
            weechat.hook_completion(
                "buffer_autoset_options",
                "list of options for buffer_autoset",
                "bas_completion_options_cb", "")
            weechat.hook_signal("9000|buffer_opened",
                                "bas_signal_buffer_opened_cb", "")
            weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME,
                                "bas_config_option_cb", "")

            # apply settings to all already opened buffers
            buffers = weechat.infolist_get("buffer", "", "")
            if buffers:
                while weechat.infolist_next(buffers):
                    buffer = weechat.infolist_pointer(buffers, "pointer")
开发者ID:AndyHoang,项目名称:dotfiles,代码行数:32,代码来源:buffer_autoset.py


示例15:

    weechat.hook_modifier('irc_in_privmsg', 'message_in_cb', '')
    weechat.hook_modifier('irc_out_privmsg', 'message_out_cb', '')

    weechat.hook_command(
        SCRIPT_NAME, SCRIPT_HELP,
        'start [NICK SERVER] || '
        'finish [NICK SERVER] || '
        'smp ask NICK SERVER SECRET [QUESTION] || '
        'smp respond NICK SERVER SECRET || '
        'trust [NICK SERVER] || '
        'policy [POLICY on|off]',
        '',
        'start %(nick) %(irc_servers) %-||'
        'finish %(nick) %(irc_servers) %-||'
        'smp ask|respond %(nick) %(irc_servers) %-||'
        'trust %(nick) %(irc_servers) %-||'
        'policy %(otr_policy) on|off %-||',
        'command_cb',
        '')

    weechat.hook_completion(
        'otr_policy', 'OTR policies', 'policy_completion_cb', '')

    weechat.hook_config('logger.level.irc.*', 'logger_level_update_cb', '')

    weechat.hook_signal('buffer_switch', 'buffer_switch_cb', '')

    OTR_STATUSBAR = weechat.bar_item_new(SCRIPT_NAME, 'otr_statusbar_cb', '')
    weechat.bar_item_update(SCRIPT_NAME)
开发者ID:frumiousbandersnatch,项目名称:weechat-scripts,代码行数:29,代码来源:otr.py


示例16:

        color %= weechat.config_integer(weechat.config_get("weechat.look.color_nicks_number"))
        color = weechat.config_get('weechat.color.chat_nick_color%02d' %(color+1))
        color = w.color(weechat.config_string(color))
    return '%s%s%s' %(color, nick, weechat.color('reset'))


if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
                        SCRIPT_DESC, "", ""):
        # Set default settings
        for option, default_value in settings.iteritems():
            if not weechat.config_is_set_plugin(option):
                weechat.config_set_plugin(option, default_value)

        weechat.hook_command(SCRIPT_COMMAND,
                             "URL bar control",
                             "[list | hide | show | toggle | url URL]",
                             "   list: list all URL and show URL bar\n"
                             "   hide: hide URL bar\n"
                             "   show: show URL bar\n"
                             "   toggle: toggle showing of URL bar\n",
                             "list || hide || show || toggle || url %(urlbar_urls)",
                             "urlbar_cmd", "")
        weechat.hook_completion("urlbar_urls", "list of URLs",
                                "urlbar_completion_urls_cb", "")
        weechat.bar_item_new("urlbar_urls", "urlbar_item_cb", "");
        weechat.bar_new("urlbar", "on", "0", "root", "", "top", "horizontal",
                        "vertical", "0", "0", "default", "default", "default", "0",
                        "urlbar_urls");
        weechat.hook_print("", "", "://", 1, "urlbar_print_cb", "")
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:urlbar.py


示例17:

                             "  /uotp list\n"+
                             "  /uotp add freenode 4c6fdb7d0659bae2a16d23bab99678462b9f7897\n"+
                             "  /uotp add freenode jrx5 w7ig lg5o filn eo5l tfty iyvz 66ex\n"+
                             "  /uotp remove freenode\n"+
                             "  /uotp enable freenode\n"+
                             "  /uotp disable freenode",
                             "otp %(irc_servers)"
                             " || list"
                             " || add %(irc_servers)"
                             " || remove %(configured_servers)"
                             " || enable %(irc_servers)"
                             " || disable %(disabled_servers)",
                             "options_cb", "")
        weechat.hook_signal("irc_server_connecting", "signal_cb", "")
        weechat.hook_signal("irc_server_disconnected", "signal_cb", "")
        weechat.hook_config("plugins.var.python.undernet_totp.otp_server_names", "config_update_cb", "")
        weechat.hook_completion("configured_servers", "list of otp configured servers", "server_completion_cb", "configured_servers")
        weechat.hook_completion("disabled_servers", "list of disabled servers", "server_completion_cb", "enabled_servers")
        weechat.hook_modifier("input_text_display", "hide_secret_cb", "")

        for option, default_value in SETTINGS.items():
            if weechat.config_get_plugin(option) == "":
                weechat.config_set_plugin(option, default_value[0])
            weechat.config_set_desc_plugin(option, '%s (default: %s)' % (default_value[1], default_value[0]))

        # For now we enable the hooks until it's possible to force script plugins to
        # load before the irc plugin on weechat startup, otherwise the irc_server_connecting signal
        # get missed.
        for server in enabled_servers():
            hook_all(server)
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:undernet_totp.py


示例18: error

    script_nick = '%s[%s%s%s]%s' %(color_delimiter, color_script_nick, 'cmpl', color_delimiter,
            color_reset)

    version = weechat.info_get('version', '')
    if version == '0.3.0':
        error('WeeChat 0.3.1 or newer is required for this script.')
    else:
        # settings
        for opt, val in settings.iteritems():
            if not weechat.config_is_set_plugin(opt):
                weechat.config_set_plugin(opt, val)

        load_replace_table()

        completion_template = 'completion_script'
        weechat.hook_completion(completion_template,
                "Replaces last word in input by its configured value.", 'completion_replacer', '')
        weechat.hook_completion('completion_keys', "Words in completion list.", 'completion_keys', '')

        weechat.hook_command(SCRIPT_COMMAND, SCRIPT_DESC , "[add <word> <text>|del <word>]",
"""
add: adds a new completion, <word> => <text>.
del: deletes a completion.
Without arguments it displays current completions.

<word> will be replaced by <text> when pressing tab in input line,
where <word> is any word currently behind the cursor.

Setup:
For this script to work, you must add the template
%%(%(completion)s) to the default completion template, use:
/set weechat.completion.default_template "%%(nicks)|%%(irc_channels)|%%(%(completion)s)"
开发者ID:Brijen,项目名称:dotfiles-6,代码行数:32,代码来源:completion.py


示例19: groups

    # /sn
    weechat.hook_command('sn',
                         'StatusNet manager',
                         'whois | subscribe | unsubscribe | block | unblock | updates | groups <username> || group | join | leave <group>',
                         '        whois: retrieves profile information from <username>'
                         "\n"
                         '    subscribe: subscribes to <username>'
                         "\n"
                         '  unsubscribe: unsubscribes from <username>'
                         "\n"
                         '        block: blocks <username>'
                         "\n"
                         '      unblock: unblocks <username>'
                         "\n"
                         '      updates: recent updates from <username> <quantity (<20)>'
                         "\n"
                         '         join: joins group <group>'
                         "\n"
                         '        leave: leaves group <group>'
                         "\n"
                         '       groups: groups (<username>) you or a specified username is subscribed'
                         "\n"
                         '        group: shows info about <group>',
                         'whois %(sn_nicks) || subscribe %(sn_nicks) || unsubscribe %(sn_nicks) || block %(sn_nicks) || unblock %(sn_nicks) || updates %(sn_nicks) || join || leave || group || groups',
                         'sn',
                         '')

    # Completion for /sn commands
    weechat.hook_completion('sn_nicks', 'list of SN users', 'nicklist', '')

开发者ID:s5unty,项目名称:dotfiles,代码行数:29,代码来源:tweetim.py


示例20: debug

        SCRIPT_NAME,
        COLOR_CHAT_DELIMITERS,
        COLOR_RESET,
    )

    weechat.hook_command(
        "infos",
        "View and use WeeChat infos",
        "show [<info_name>] || get <info_name> [<arguments>]",
        "show: Shows information about all infos or info <info_name>.\n" " get: Get info <info_name>.",
        "get|show %(infos_info_list)",
        "cmd_infos",
        "",
    )

    weechat.hook_completion("infos_info_list", "List of info names", "cmpl_infos_list", "")

    # -------------------------------------------------------------------------
    # Debug

    if weechat.config_get_plugin("debug"):
        try:
            # custom debug module I use, allows me to inspect script's objects.
            import pybuffer

            debug = pybuffer.debugBuffer(globals(), "%s_debug" % SCRIPT_NAME)
        except ImportError:

            def debug(s, *args):
                if not isinstance(s, basestring):
                    s = str(s)
开发者ID:norrs,项目名称:weechat-plugins,代码行数:31,代码来源:infos.py



注:本文中的weechat.hook_completion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python weechat.hook_completion_list_add函数代码示例发布时间:2022-05-26
下一篇:
Python weechat.hook_command_run函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap