from . import log class NickServ(): def recover_nick(connection, password): log.info('Recovering nickname.') connection.privmsg('NickServ', 'IDENTIFY %s %s' % (self.network.nickname, password)) # Identify with NickServ. connection.privmsg('NickServ', 'RECOVER %s %s' % (self.network.nickname, password)) # Recover control of nickname via NickServ. connection.privmsg('NickServ', 'GHOST %s %s' % (self.network.nickname, password)) # Recover control of nickname via NickServ, old style. connection.nick(connection.nickname) # Set original nickname. Should have happened during the nickServ recover, this fails when still connecting. So this creates a loop to successfully recover via NickServ. class ChanServ(): def invite(connection, channel_name): log.info('Requesting ChanServ to invite me to %s' % channel_name) connection.privmsg("ChanServ", "INVITE " + channel_name) def getkey(connection, channel_name): log.info('Requesting ChanServ password for channel %s' % channel_name) connection.privmsg("ChanServ", "GETKEY " + channel_name) def ban(connection, channel_name, user_name, reason): log.info('Requesting ChanServ to ban %s from %s for %s' % (user_name, channel_name, reason)) connection.privmsg("ChanServ", "BAN " + channel_name + " " + user_name + " " + reason) def tempban(connection, channel_name, user_name, duration, reason): log.info('Requesting ChanServ to ban %s for %s in %s %s for %s' % (user_name, reason, channel_name, duration)) connection.privmsg("ChanServ", "BAN " + channel_name + " +" + duration + " " + user_name + " " + reason) def unban(connection, channel_name, user_name): log.info('Requesting ChanServ to ubnan %s from %s.' %(user_name, channel_name)) connection.privmsg("ChanServ", "UNBAN " + channel_name + " " + user_name) def akick_add(connection, channel_name, user_name): log.info('Requesting ChanServ to add %s to the auto kick list of %s.' % (user_name, channel_name)) connection.privmsg("ChanServ", "AKICK " + channel_name + " ADD " + user_name) def akick_del(connection, channel_name, user_name): log.info('Requesting ChanServ to remove %s to the auto kick list of %s.' % (user_name, channel_name)) connection.privmsg("ChanServ", "AKICK " + channel_name + " DEL " + user_name) def kick(connection, channel_name, user_name, reason): log.info('Requesting ChanServ to kick %s from %s.' % (user_name, channel_name)) connection.privmsg("ChanServ", "KICK " + channel_name + " " + user_name + " " + reason) def give_mode(connection, channel_name, user_name, mode): if mode[1] == "q": modename = "OWNER" if mode[1] == "a": modename = "PROTECT" if mode[1] == "o": modename = "OP" if mode[1] == "h": modename = "HALFOP" if mode[1] == "v": modename = "VOICE" log.info('Requesting ChanServ grant %s to %s on %s' % (modename, user_name, channel_name)) connection.privmsg("ChanServ", modename + " " + channel_name + " " + user_name) def take_all_modes(connection, channel_name, user_name): log.info('Requesting ChanServ strip %s of all modes in %s.' % (user_name, channel_name)) connection.privmsg("ChanServ", "DEVOICE " + channel_name + " " + user_name) connection.privmsg("ChanServ", "DEHALFOP " + channel_name + " " + user_name) connection.privmsg("ChanServ", "DEOP " + channel_name + " " + user_name) connection.privmsg("ChanServ", "DEPROTECT " + channel_name + " " + user_name) connection.privmsg("ChanServ", "DEOWNER " + channel_name + " " + user_name)