Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #7
0
def service(nickname, info, distribution='*', type=0, reserved='*'):
    """
    
    """
    
    return utils.format(constants.SERVICE, nickname, reserved, distribution,
                        type, reserved, info, spaced=True)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #11
0
def namesx():
    
    return utils.format(constants.NAMESX)
Exemple #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)
Exemple #13
0
def help():
    
    return utils.format(constants.HELP)
Exemple #14
0
def away(message=None):
    
    if message is None:
        return utils.format(constants.AWAY)
    
    return utils.format(constants.AWAY, message, spaced=True)
Exemple #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)
Exemple #16
0
def userip(nickname):
    
    return utils.format(constants.USERIP, nickname)
Exemple #17
0
def wallops(message):
    
    return utils.format(constants.WALLOPS, message, spaced=True)
Exemple #18
0
def users(target=None):
    
    if target is None:
        return utils.format(constants.USERS)
        
    return utils.format(constants.USERS, target)
Exemple #19
0
def restart():
    
    return utils.format(constants.RESTART)
Exemple #20
0
def die():
    
    return utils.format(constants.DIE)
Exemple #21
0
def rehash():
    
    return utils.format(constants.REHASH)
Exemple #22
0
def rules():
    
    return utils.format(constants.RULES)
Exemple #23
0
def setname(realname):
    
    return utils.format(constants.SETNAME, realname, spaced=True)
Exemple #24
0
def ison(nickname, *nicknames):
    
    nicknames = nickname, *nicknames
    nicknames = ' '.join(nicknames)
    
    return utils.format(constants.ISON, nicknames)
Exemple #25
0
def uhnames():
    
    return utils.format(constants.UHNAMES)
Exemple #26
0
def cnotice(nickname, channel, message):
    
    return utils.format(constants.CNOTICE, nickname, channel, message, spaced=True)
Exemple #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)
Exemple #28
0
def cprivmsg(nickname, channel, message):
    
    return utils.format(constants.CPRIVMSG, nickname, channel, message, spaced=True)
Exemple #29
0
def userhost(nickname, *nicknames):
    
    nicknames = nickname, *nicknames
    nicknames = ' '.join(nicknames)
    
    return utils.format(constants.USERHOST, nicknames)
Exemple #30
0
def error(message):
    
    return utils.format(constants.ERROR, message, spaced=True)