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)
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)
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)
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)
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)
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)
def service(nickname, info, distribution='*', type=0, reserved='*'): """ """ return utils.format(constants.SERVICE, nickname, reserved, distribution, type, reserved, info, spaced=True)
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)
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)
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)
def namesx(): return utils.format(constants.NAMESX)
def knock(channel, message=None): if message is None: return utils.format(constants.KNOCK, channel) return utils.format(constants.KNOCK, channel, message, spaced=True)
def help(): return utils.format(constants.HELP)
def away(message=None): if message is None: return utils.format(constants.AWAY) return utils.format(constants.AWAY, message, spaced=True)
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)
def userip(nickname): return utils.format(constants.USERIP, nickname)
def wallops(message): return utils.format(constants.WALLOPS, message, spaced=True)
def users(target=None): if target is None: return utils.format(constants.USERS) return utils.format(constants.USERS, target)
def restart(): return utils.format(constants.RESTART)
def die(): return utils.format(constants.DIE)
def rehash(): return utils.format(constants.REHASH)
def rules(): return utils.format(constants.RULES)
def setname(realname): return utils.format(constants.SETNAME, realname, spaced=True)
def ison(nickname, *nicknames): nicknames = nickname, *nicknames nicknames = ' '.join(nicknames) return utils.format(constants.ISON, nicknames)
def uhnames(): return utils.format(constants.UHNAMES)
def cnotice(nickname, channel, message): return utils.format(constants.CNOTICE, nickname, channel, message, spaced=True)
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)
def cprivmsg(nickname, channel, message): return utils.format(constants.CPRIVMSG, nickname, channel, message, spaced=True)
def userhost(nickname, *nicknames): nicknames = nickname, *nicknames nicknames = ' '.join(nicknames) return utils.format(constants.USERHOST, nicknames)
def error(message): return utils.format(constants.ERROR, message, spaced=True)