示例#1
0
def whois(mask, *masks, target=None):
    masks = mask, *masks
    masks = ','.join(masks)
    
    if target is None:
        return utils.format(constants.WHOIS, masks)
    
    return utils.format(constants.WHOIS, target, masks)
示例#2
0
def kick(channel, nickname, *nicknames, message=None):
    
    nicknames = nickname, *nicknames
    nicknames = ','.join(nicknames)
    
    if message is None:
        return utils.format(constants.KICK, channel, nicknames)
    
    return utils.format(constants.KICK, channel, nicknames, message, spaced=True)
示例#3
0
def list(channel, *channels, target=None):
    
    channels = channel, *channels
    channels = ','.join(channels)
    
    if target is None:
        return utils.format(constants.LIST, channels)
    
    return utils.format(constants.LIST, channels, target)
示例#4
0
def names(channel, *channels, target=None):
    
    channels = channel, *channels
    channels = ','.join(channels)
    
    if target is None:
        return utils.format(constants.NAMES, channels)
    
    return utils.format(constants.NAMES, channels, target)
示例#5
0
def part(channel, *channels, message=None):
    
    channels = channel, *channels
    channels = ','.join(channels)
    
    if message is None:
        return utils.format(constants.PART, channels)
    
    return utils.format(constants.PART, channels, message, spaced=True)
示例#6
0
def join(channel, *channels, keys=None):
    channels = channel, *channels
    
    if keys is None:
        channels = ','.join(channels)        
        return utils.format(constants.JOIN, channels)
    
    channels, keys = zip(*itertools.zip_longest(channels, keys, fillvalue=''))
    
    channels = ','.join(channels)
    keys = ','.join(keys)
    
    return utils.format(constants.JOIN, channels, keys)
示例#7
0
def service(nickname, info, distribution='*', type=0, reserved='*'):
    """
    
    """
    
    return utils.format(constants.SERVICE, nickname, reserved, distribution,
                        type, reserved, info, spaced=True)
示例#8
0
def unsilence(nickname, *nicknames):
    # only removes nicknames to ignore list, see silence to add
    nicknames = nickname, *nicknames
    formatted = ['-{}'.format(nick) for nick in nicknames]
    
    
    return utils.format(constants.SILENCE, *formatted)
示例#9
0
def summon(user, target=None, channel=None):
    
    args = [constants.SUMMON, user]
    
    if target is not None:
        args.append(target)
        
    if channel is not None:
        args.append(channel)
        
    return utils.format(*args)
示例#10
0
def whowas(nickname, *nicknames, count=None, target=None):
    nicknames = nickname, *nicknames
    nicknames = ','.join(nicknames)
    
    args = [constants.WHOWAS, nicknames]
    
    if count is not None:
        args.append(count)
        
    if target is not None:
        args.append(target)
        
    return utils.format(*args)
示例#11
0
def namesx():
    
    return utils.format(constants.NAMESX)
示例#12
0
def knock(channel, message=None):
    
    if message is None:
        return utils.format(constants.KNOCK, channel)
    
    return utils.format(constants.KNOCK, channel, message, spaced=True)
示例#13
0
def help():
    
    return utils.format(constants.HELP)
示例#14
0
def away(message=None):
    
    if message is None:
        return utils.format(constants.AWAY)
    
    return utils.format(constants.AWAY, message, spaced=True)
示例#15
0
def unwatch(nickname, *nicknames):
    # only removes nicknames to watch list, see watch to add
    nicknames = nickname, *nicknames
    formatted = ['-{}'.format(nick) for nick in nicknames]
    
    return utils.format(constants.WATCH, *formatted)
示例#16
0
def userip(nickname):
    
    return utils.format(constants.USERIP, nickname)
示例#17
0
def wallops(message):
    
    return utils.format(constants.WALLOPS, message, spaced=True)
示例#18
0
def users(target=None):
    
    if target is None:
        return utils.format(constants.USERS)
        
    return utils.format(constants.USERS, target)
示例#19
0
def restart():
    
    return utils.format(constants.RESTART)
示例#20
0
def die():
    
    return utils.format(constants.DIE)
示例#21
0
def rehash():
    
    return utils.format(constants.REHASH)
示例#22
0
def rules():
    
    return utils.format(constants.RULES)
示例#23
0
def setname(realname):
    
    return utils.format(constants.SETNAME, realname, spaced=True)
示例#24
0
def ison(nickname, *nicknames):
    
    nicknames = nickname, *nicknames
    nicknames = ' '.join(nicknames)
    
    return utils.format(constants.ISON, nicknames)
示例#25
0
def uhnames():
    
    return utils.format(constants.UHNAMES)
示例#26
0
def cnotice(nickname, channel, message):
    
    return utils.format(constants.CNOTICE, nickname, channel, message, spaced=True)
示例#27
0
def watch(nickname, *nicknames):
    # only adds nicknames to watch list, see unwatch to remove
    nicknames = nickname, *nicknames
    formatted = ['+{}'.format(nick) for nick in nicknames]
    
    return utils.format(constants.WATCH, *formatted)
示例#28
0
def cprivmsg(nickname, channel, message):
    
    return utils.format(constants.CPRIVMSG, nickname, channel, message, spaced=True)
示例#29
0
def userhost(nickname, *nicknames):
    
    nicknames = nickname, *nicknames
    nicknames = ' '.join(nicknames)
    
    return utils.format(constants.USERHOST, nicknames)
示例#30
0
def error(message):
    
    return utils.format(constants.ERROR, message, spaced=True)