def robocop(self, message, request_id, mode): request = Request.load(request_id, active=False) if request is None: return if mode == "cancel": reply = "Cancelled scan request %s" % (request.id,) message.privmsg(reply, self.scanchan()) nicks = CUT.list_user_nicks(request.user.name) for nick in nicks: message.privmsg(reply, nick) return if mode == "block": reply = "Updated request %s dists to %s" % (request.id, request.dists,) message.privmsg(reply, self.scanchan()) nicks = CUT.list_user_nicks(request.user.name) for nick in nicks: message.privmsg(reply, nick) return user = request.user planet = request.target dists_intel = planet.intel.dists if planet.intel else 0 message.privmsg("[%s] %s requested a %s Scan of %s:%s:%s Dists(i:%s/r:%s) " % (request.id, user.name, request.type, planet.x,planet.y,planet.z, dists_intel, request.dists,) + request.link, self.scanchan())
def robocop(self, message, scantype, pa_id, x, y, z, names): nicks = [] [nicks.extend(nick) for nick in [CUT.list_user_nicks(name) for name in names.split(",")]] reply = "%s on %s:%s:%s " % (PA.get(scantype,"name"),x,y,z,) reply+= Config.get("URL","viewscan") % (pa_id,) for nick in nicks: message.privmsg(reply, nick) reply = "%s on %s:%s:%s " % (PA.get(scantype,"name"),x,y,z,) reply+= "delivered to: " reply+= ", ".join(nicks) from Hooks.scans.request import request message.privmsg(reply, request().scanchan())
def blocks(self, message, user, params): id = params.group(1) dists = int(params.group(2)) request = Request.load(id) if request is None: message.reply("No open request number %s exists (idiot)."%(id,)) return request.dists = max(request.dists, dists) session.commit() reply = "Updated request %s dists to %s" % (id, request.dists,) message.reply(reply) if message.get_chan() != self.scanchan(): message.privmsg(reply, self.scanchan()) nicks = CUT.list_user_nicks(request.user.name) if message.get_nick() not in nicks: for nick in nicks: message.privmsg(reply, nick)
def cancel(self, message, user, params): id = params.group(1) request = Request.load(id) if request is None: message.reply("No open request number %s exists (idiot)."%(id,)) return if request.user is not user and not user.is_admin() and not self.is_chan(message, self.scanchan()): message.reply("Only %s may cancel request %s."%(request.user.name,id)) return request.active = False session.commit() reply = "Cancelled scan request %s" % (id,) message.reply(reply) if message.get_chan() != self.scanchan(): message.privmsg(reply, self.scanchan()) nicks = CUT.list_user_nicks(request.user.name) if message.get_nick() not in nicks: for nick in nicks: message.privmsg(reply, nick)
def robocop(self, message, scantype, pa_id, x, y, z, names): reply = "%s on %s:%s:%s " % (PA.get(scantype,"name"),x,y,z,) reply+= Config.get("URL","viewscan") % (pa_id,) for name in names.split(","): for nick in CUT.list_user_nicks(name): message.privmsg(reply, nick)