Пример #1
0
        a = args[i]
        if a == "-t":
            i += 1
            if i >= len(args):
                kaechatlib.usage(frame, cmd, "Missing parameter to `-t'.")
                return
            try:
                timeout = int(args[i])
            except ValueError:
                kaechatlib.usage(frame, cmd, "Timeout must be an integer.")
                return
        elif a == "-c":
            i += 1
            if i >= len(args):
                kaechatlib.usage(frame, cmd, "Missing parameter to `-c'.")
                return
            channel = args[i]
        elif a == "-s":
            send = True
        else:
            break
        i += 1
    if i >= len(args):
        kaechatlib.usage(frame, cmd, "Missing command.")
        return
    command = args_eol[i]
    t = ShellThread(frame, timeout, channel, send, command)
    t.start()

kaechatlib.chat_command_alias("!", "sh")
Пример #2
0
    Disconnect from the current network, optionally with a reason.
    """
    reason = args_eol[0] if len(args) >= 1 else None
    frame.client.disconnect(reason)


@kaechatlib.chat_command
def _help(frame, cmd, args, args_eol):
    """/help [COMMAND]

    Get help on COMMAND, or a short description of all commands if none
    is specified.
    """
    if len(args) == 1:
        kaechatlib.usage(frame, args[0], full=True)
    else:
        for name in sorted(kaechatlib.chat_commands.keys()):
            kaechatlib.usage(frame, name, prefix="")


kaechatlib.chat_command_alias("m", "msg")
kaechatlib.chat_command_alias("afk", "away")
kaechatlib.chat_command_alias("connect", "server")
kaechatlib.chat_command_alias("discon", "quit")
kaechatlib.chat_command_alias("disconnect", "quit")

kaechatlib.macro("ns", "msg NickServ", params="/ns MESSAGE", minargs=1)
kaechatlib.macro("cs", "msg ChanServ", params="/cs MESSAGE", minargs=1)
kaechatlib.macro("id", "msg NickServ identify", params="/id USERNAME PASSWORD", minargs=2)