def on_pubmsg(self, c, e): src_nick = e.source().split('!')[0] if self.cmds_run % 10 == 0: self.refresh_users() a = e.arguments()[0].split(":", 1) if len(a) > 1 and irclib.irc_lower(a[0]) == irclib.irc_lower(self.connection.get_nickname()): cmd = a[1].strip() addressed_to=self.nickname elif e.arguments()[0].startswith( "%s:" % self.nickname ): cmd = a[-1].strip() addressed_to=self.nickname elif e.arguments()[0].startswith( "all:"): cmd = a[-1].strip() addressed_to='all' elif e.target().lower() == "#%s" % self.nickname.lower() and e.arguments()[0].startswith('~'): cmd = e.arguments()[0][1:].strip() addressed_to=self.nickname else: cmd = None addressed_to = None if cmd is not None and src_nick in self.authorized_nicks: self.cmds_run += 1 self.do_cmd(e, cmd, addressed_to=addressed_to ) elif cmd is not None: #c.notice( self.authorized_nicks[0], "%s is bothering me!" % src_nick ) c.privmsg( SADM_CHANNEL, "~lart %s for bothering me" % src_nick ) print( "%s is bothering me!" % src_nick )
def _handle_cmds(self, c, e, line): debug.send('in _handle_cmds',5) if line and len(line) > 0: sendhelp = False chan = self.channel if chan == irc_lower(self.connection.get_nickname()): chan = irc_lower(nm_to_n(e.source())) debug.send(('chan in _handle_cmds',chan),5) word0 = line[0].strip() if word0 and len(word0) > 0: cmd_args_list = word0.lower()[1:].strip().split() else: return if len(cmd_args_list) > 0: cmd = cmd_args_list[0] else: return debug.send(('cmd,line,cmd_args_list in _handle_cmds',cmd,line,cmd_args_list),5) args = [] if len(cmd_args_list) > 1: args = [x.strip() for x in cmd_args_list[1:]] debug.send(('args in _handle_cmds',args),5) if len(args) > 1 and args[1] in HELPSTR: sendhelp = True if cmd == 'space': if sendhelp: self._send_help(c,cmd,chan) else: self._status_msg(args,chan) elif cmd == 'help': self._send_help(c,cmd,args,chan) else: self.do_command(e,cmd.lower())
def on_pubmsg(self, c, e): nick = nm_to_n(e.source()) target = e.target() a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip(), target) return
def on_pubmsg(self, c, e): msg = e.arguments()[0] a = msg.split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.command_handler.process_command(e, a[1].strip()) elif msg[:1] == "!" and ((msg.find("!",1,4) & msg.find("?",1,4)) == -1): self.command_handler.process_command(e, msg[1:])
def on_pubmsg(self, c, e): # Handle a message recieved from the channel source_name = nm_to_n(e.source()).lower() source_host = nm_to_h(e.source()) message = e.arguments()[0] if source_name in self.ignore: return self.last_message_sender = self.channel # If a message was addressed specifically to the bot, note this and strip # this from the message addressed_to_BeardBot = False if irc_lower(message).startswith("%s: " % self.nick.lower()): message = message.split(": ", 1)[-1] addressed_to_BeardBot = True elif irc_lower(message).startswith("%s, " % self.nick.lower()): message = message.split(", ", 1)[-1] addressed_to_BeardBot = True # Alert each module that a message has arrived for module in self.modules.values(): try: if addressed_to_BeardBot: module.handle_addressed_message(source_name, source_host, message.decode("UTF8")) else: module.handle_channel_message(source_name, source_host, message.decode("UTF8")) except Exception, e: traceback.print_exc(file=sys.stdout)
def on_pubmsg(self, connection, event): #log.info("Pubmsg: " + event.arguments()[0]) args = event.arguments()[0].split(":", 1) if len(args) > 1 and irc_lower(args[0]) == irc_lower( self.connection.get_nickname()): self.do_command(event, args[1].strip()) return
def on_pubmsg(self, c, e): ch = self.channel nick = nm_to_n(e.source()) if self.bot_talking(nick): return try: chat = unicode(e.arguments()[0], "utf-8") except: chat = "### INVALID UTF-8 ###" if c.server == self.main_server: try: self.log(datetime.now(),nick,chat) a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0].strip()) == irc_lower(self.connection.get_nickname()): said = a[1].strip().split() if not self.validate(a[1].strip()): c.privmsg(ch, nick+": Haha I got you =)") return if len(said)==0: self.yessir(c, e) elif len(said)==1: cmd = said[0] self.one_param_command(c, e, cmd) elif len(said)>1: if not self.pyflg: cmd = said[0] param = said[1] self.many_param_command(c, e, cmd, param) else: self.one_param_command(c, e, a[1].strip()) return except Exception, e: c.privmsg(ch, str(e)) print traceback.format_exc()
def on_pubmsg(self, c, e): from_nick = nm_to_n(e.source()) a = string.split(e.arguments()[0], ':', 1) if len(a) > 1 \ and irc_lower(a[0]) == irc_lower(self.nickname): self.do_command(e, string.strip(a[1]), from_nick) return
def change_nick(self, before, after): self.userdict[after] = self.userdict[before] # fixed: if user only swap case, dont delete her/him # else user will disappear from dict. # --Pasqual 2010.03.11 03:03:03 CEST if irc_lower(after) != irc_lower(before): del self.userdict[before]
def on_pubmsg(self, c, e): if nm_to_n(e.source()).find("noise") != -1: return a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.do_command(e, string.strip(a[1])) return keywordmap=[['schlong', 'penis'], ['g****e', 'g****e'], ['cornholio', 'g****e'], ['c**t', 'v****a'], ['twat', 'v****a'], ['pussy', 'v****a'], ['dongbot', 'robot'], ['balls', 'balls'], ['wtf', 'japan'], ['tallywhacker', 'penis'], ['johnson', 'penis'], ['peter', 'penis'], ['pecker', 'penis'], ['dick', 'penis'], ['wang', 'penis'], ['willy', 'penis'], ['trouser snake', 'penis'], ['lower horn', 'penis'], ['third leg', 'penis'], ['one eyed willy', 'penis']] results=filter(lambda x: e.arguments()[0].find(x[0]) != -1, keywordmap) if bool(results): self.searchfor(c, e, results[0][1]) return
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): if a[1].startswith("notracks") and self.last_artist_name != "": self.connection.privmsg(self.channel, "trackfinder:"+self.last_artist_name.encode('ascii', 'ignore')) else: self.do_command(e, a[1])
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) elif len(a) > 1: nick = nm_to_n(e.source()) self.linkbot.on_chat(nick, a[0], a[1].strip())
def on_pubmsg(self, c, e): a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, string.strip(a[1])) elif e.arguments()[0][0] == '@': self.do_command(e, (e.arguments()[0][1:]).strip()) return
def on_pubmsg(self, c, e): src_nick = e.source().split('!')[0] if self.cmds_run % 10 == 0: self.refresh_users() a = e.arguments()[0].split(":", 1) if len(a) > 1 and irclib.irc_lower(a[0]) == irclib.irc_lower( self.connection.get_nickname()): cmd = a[1].strip() addressed_to = self.nickname elif e.arguments()[0].startswith("%s:" % self.nickname): cmd = a[-1].strip() addressed_to = self.nickname elif e.arguments()[0].startswith("all:"): cmd = a[-1].strip() addressed_to = 'all' elif e.target().lower() == "#%s" % self.nickname.lower( ) and e.arguments()[0].startswith('~'): cmd = e.arguments()[0][1:].strip() addressed_to = self.nickname else: cmd = None addressed_to = None if cmd is not None and src_nick in self.authorized_nicks: self.cmds_run += 1 self.do_cmd(e, cmd, addressed_to=addressed_to) elif cmd is not None: #c.notice( self.authorized_nicks[0], "%s is bothering me!" % src_nick ) c.privmsg(SADM_CHANNEL, "~lart %s for bothering me" % src_nick) print("%s is bothering me!" % src_nick)
def on_pubmsg(self, c, e): if nm_to_n(e.source()).find("noise") != -1: return a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.do_command(e, string.strip(a[1])) if irc_lower(e.arguments()[0]).find(".bart") == 0: self.cmd_times(e.arguments()[0].strip().split(" ")[1:], e)
def on_pubmsg(self, c, e): self.check_game_control(e) s = e.arguments()[0] a = string.split(s, ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.do_command(e, string.strip(a[1])) if s[0]=='!' and (len(s) > 1) and s[1]!='!': self.do_command(e, string.strip(s[1:]))
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) elif len(a) > 1: print "Attempting interrupt" self.interrupt(nm_to_n(e.source()), a[1].strip()) return
def on_pubmsg(self, c, e): a = e.arguments()[0].split(",", 1) print datetime.now().strftime("%d/%m/%y %H:%M:%S") + " <" + nm_to_n( e.source()) + "> " + e.arguments()[0] if len(a) > 1 and irc_lower(a[0]) == irc_lower( self.connection.get_nickname()): self.do_command(e, a[1].strip()) return
def on_pubmsg(self, c, e): a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower( self.connection.get_nickname()): self.do_command(e, string.strip(a[1])) elif e.arguments()[0][0] == '@': self.do_command(e, (e.arguments()[0][1:]).strip()) return
def on_pubmsg(self, c, e): self.check_game_control(e) s = e.arguments()[0] a = string.split(s, ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.do_command(e, string.strip(a[1])) if s[0] == '!' and (len(s) > 1) and s[1] != '!': self.do_command(e, string.strip(s[1:]))
def on_pubmsg(self, c, e): if nm_to_n(e.source()).find("noise") != -1: return a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(c.get_nickname()): self.do_command(e, string.strip(a[1])) if irc_lower(e.arguments()[0]).find(".sql") == 0: self.cmd_eval(e.arguments()[0].strip().split(" ")[1:], e)
def _irc_nameq(x, y): """Returns True if two names are considered equal according to the RFC.""" # Better to call this with unicode objects, of course, but if it is sure # that the encoding is ASCII compatible (IRC nicknames MUST contain only # ACII chars) you can call it with byte strings too. assert(isinstance(x, basestring)) assert(isinstance(y, basestring)) assert(type(x) == type(y)) return irclib.irc_lower(x) == irclib.irc_lower(y)
def on_pubmsg(self, c, e): rawText = e.arguments()[0] cleanText = irc_lower(rawText).translate(string.maketrans("",""), string.punctuation) sourceNick = nm_to_n(e.source()) botNick = irc_lower(c.get_nickname()) if sourceNick == self.getBossName() and irc_lower(rawText).startswith(botNick+"!"): self.do_command(e, cleanText.split()[1]) elif cleanText.startswith(botNick+" ") or cleanText.endswith(" "+botNick) or not cleanText.find(" "+botNick+" ") is -1 or cleanText == botNick: self.brain.processData(self, c, sourceNick, rawText, cleanText)
def get_bots_by_channel(self, channel): if isinstance(channel, str): channel = self.encode(channel)[0] channel = irclib.irc_lower(channel) bots = [] for bot in self.bots: if channel in [irclib.irc_lower(_) for _ in bot.channels]: bots.append(bot) return bots
def on_pubmsg(self, c, e): args = e.arguments() msg = irc_lower(args[0]) channel = e.target() source = nm_to_n(e.source()) mynick = irc_lower(c.get_nickname()) if self.is_listening(channel): self.writeLog("pubmsg", e.source(), e.target(), args[0])
def on_pubmsg(self, c, e): who = nm_to_n(e.source()) print 'pubmsg' print e.arguments() print " from " + who + " to " + e.target() a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) return
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) dowordcheck = True if len(a) > 1 and irc_lower(a[0]).lower() == irc_lower(self.connection.get_nickname()).lower(): self.do_command(e, a[1].strip()) else: self.check_words(c,e)
def on_pubmsg (self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): question = irc_lower(a[1].strip()) if question == "latest episode": self.getLatestEpisode(c) elif question[:11] == 'get episode': self.getEpisode(question, c) else: self.eliza_parser(question, c)
def on_pubmsg(self, c, e): comment = e.arguments()[0] nick = nm_to_n(e.source()) host = nm_to_h(e.source()) if irc_lower(comment).startswith(irc_lower(self.connection.get_nickname()+": openid=")): try: utils.addOidUser(nick, comment[len(self.connection.get_nickname()+": openid="):]) self.connection.privmsg(e.target(), "Ok") except ValueError, LookupError: self.connection.privmsg(e.target(), "Invalid OpenID")
def on_pubmsg(self, c, e): message = e.arguments()[0].lower() canal = e.target() if message == "chell": c.privmsg(canal, "Do not mention her !") a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) return
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) resp = getResponse(e.arguments()[0]) #take the message, get response # c.notice(self.channel, getResponse(e.arguments()[0])) if type(resp) == list: #someitmes we get back a bunch of lines for x in resp: c.notice(self.channel, x) else: c.notice(self.channel, resp) #otherwise, a string return
def on_pubmsg(self, c, e): nick = nm_to_n(e.source()) c = self.connection if nick == c.get_nickname(): return a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) else: cmd = e.arguments()[0] if cmd[0] == '>': self.interpret(e, cmd[1:])
def on_pubmsg(self, c, e): from_nick = nm_to_n(e.source()) a = e.arguments()[0].split(":", 1) if len(a) > 1 \ and irc_lower(a[0]) == irc_lower(self.nickname): self.do_command(e, a[1].strip(), from_nick) ## also fire on "mynick, message" a = e.arguments()[0].split(",", 1) if len(a) > 1 \ and irc_lower(a[0]) == irc_lower(self.nickname): self.do_command(e, a[1].strip(), from_nick) return
def on_pubmsg(self, c, e): nick = nm_to_n(e.source()) c = self.connection if nick == c.get_nickname(): return a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower( self.connection.get_nickname()): self.do_command(e, a[1].strip()) else: cmd = e.arguments()[0] if cmd[0] == '>': self.interpret(e, cmd[1:])
def on_pubmsg(self, c, e): msg = e.arguments()[0] nick = nm_to_n(e.source()) a = string.split(msg, ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): output = self.do_command(nick, string.strip(a[1])) else: output = self.chump.process_input(nick, msg) if output != None: self.notice_multiline(c,output)
def on_pubmsg(self, c, e): rawText = e.arguments()[0] cleanText = irc_lower(rawText).translate(string.maketrans("", ""), string.punctuation) sourceNick = nm_to_n(e.source()) botNick = irc_lower(c.get_nickname()) if sourceNick == self.getBossName() and irc_lower(rawText).startswith( botNick + "!"): self.do_command(e, cleanText.split()[1]) elif cleanText.startswith(botNick + " ") or cleanText.endswith( " " + botNick) or not cleanText.find( " " + botNick + " ") is -1 or cleanText == botNick: self.brain.processData(self, c, sourceNick, rawText, cleanText)
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) else: source_nick = nm_to_n(e.source()) self.irc_display_buffer.append(source_nick + ": " + e.arguments()[0]) if len(self.irc_display_buffer) > 3: self.irc_display_buffer = self.irc_display_buffer[1::] last_message = "" for message in self.irc_display_buffer: print message self.sign.TwoLine(last_message, message) last_message = message return
def on_pubmsg(self, conn, event): if event.arguments()[0][0] in self.short_symbols and \ len(event.arguments()[0]) > 1: cmd = event.arguments()[0][1:] self.do_command(event, cmd) else: args = event.arguments()[0].split(":", 1) if len(args) == 1: args = event.arguments()[0].split(",", 1) if len(args) > 1 and \ irc_lower(args[0]) == irc_lower(self.connection.get_nickname()): cmd = args[1].strip() else: return self.do_command(event, cmd)
def pop_buffer(self, message_buffer): message = message_buffer.peek() if message.timestamp > time.time(): # 미래에 보여줄 것은 미래까지 기다림 # TODO: ignore_time이면 이 조건 무시 return False if self.silent: return self.process_message(message_buffer.pop()) if message.command in ['privmsg']: target = message.arguments[0] chan = irclib.irc_lower(self.codec.encode(target)[0]) if irclib.is_channel(chan): if chan not in [irclib.irc_lower(_) for _ in self.channels]: self.connection.join(chan) return BufferingBot.pop_buffer(self, message_buffer)
def on_privnotice(self, c, e): source = e.source() if source and irc_lower(nm_to_n(source)) == 'nickserv': if e.arguments()[0].find('IDENTIFY') >= 0: # Received request to identify if self.nickpass and self.desired_nickname == c.get_nickname(): self.queue.send('identify %s' % self.nickpass, 'nickserv')
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower( self.connection.get_nickname()): self.do_command(e, a[1].strip()) else: source_nick = nm_to_n(e.source()) self.irc_display_buffer.append(source_nick + ": " + e.arguments()[0]) if len(self.irc_display_buffer) > 3: self.irc_display_buffer = self.irc_display_buffer[1::] last_message = "" for message in self.irc_display_buffer: print message self.sign.TwoLine(last_message, message) last_message = message return
def __delitem__(self, key): ck = irc_lower(key) del self.data[self.canon_keys[ck]] del self.canon_keys[ck]
def __setitem__(self, key, item): if key in self: del self[key] self.data[key] = item self.canon_keys[irc_lower(key)] = key
def __getitem__(self, key): return self.data[self.canon_keys[irc_lower(key)]]
def on_pubmsg(self, c, e): a = string.split(e.arguments()[0], ":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()): self.do_message(e, string.strip(a[1])) return
def processData(self, bot, chat, nick, rawText, cleanText): cleanText = cleanText.replace(irc_lower(chat.get_nickname()), "").strip() time.sleep(0.25 * len(cleanText)) bot.say(chat, self.k.respond(cleanText))
def do_command(self, e, cmd): nick = nm_to_n(e.source()) c = self.connection print("{nick}: {cmd}".format(nick=nick, cmd=cmd)) input = cmd args = cmd.split() cmd = args[0] args = [irc_lower(arg) for arg in args] cmd = irc_lower(cmd) #if cmd in ("disconnect", "die"): # sys.exit(1) if cmd in ("exit", "quit"): if self.process: self.kill_game() c.privmsg( self.channel, '{nick} has quit the current game.'.format(nick=nick)) else: c.notice(nick, 'No game is currently active.') return elif cmd in ("reset", "restart", "reboot", "rejoin"): raise RejoinExit("Restarting the client...") elif cmd in ('play', 'load', 'start', 'create', 'open', 'run'): if self.process: c.notice( nick, 'You cannot start a new game until you have quit the current one.' ) return if len(args) < 2: c.notice(nick, "You must specify a game to play.") return terp = None if len(args) > 2: if args[1] in self.terps: terp = self.terps[args[1]] game = input.split(None, 2)[2] if terp is None: unused, game = input.split(None, 1) unused, ext = os.path.splitext(game) if ext not in self.terp_exts: c.notice( nick, "The '{ext}' extension is unknown; " "first specify the interpreter to use '{name}: start [interpreter] [game]' " "to try to run this game.".format(ext=ext, name=self.nickname)) return terp = self.terps[self.terp_exts[ext]] #game = urllib.quote(game) gamepath = simplify(game) gameroot, unused = os.path.splitext(gamepath) unused, gamepath = os.path.split(gamepath) gamepath = os.path.join(gameroot, gamepath) if not os.path.exists(gamepath): try: os.makedirs(gameroot) except: pass try: success = self.download_game(nick, game, gamepath) if not success: return except Exception: print("Exception occurred during download.") traceback.print_exc(file=sys.stdout) c.notice( nick, "Could not find the specified game '{uri}'.".format( uri=game)) return if not os.path.exists(gamepath) or not os.path.exists(gameroot): c.notice( nick, "Error accessing downloaded file for game '{uri}'.".format( uri=game)) return unused, gamename = os.path.split(gamepath) command = terp.format(file=gamename) command = command.split(' ') try: self.process = subprocess.Popen( command, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, #close_fds=True, cwd=gameroot) except Exception as err: print("Error starting game.") traceback.print_exc(file=sys.stdout) if self.process: time.sleep(.5) self.process.poll() if self.process.returncode is not None: self.kill_game() c.notice(nick, "The game loaded but quit immediately.") return c.privmsg( self.channel, '{nick} has started the game {game}.'.format( nick=nick, game=gamepath)) self.thread = threading.Thread(target=self.run_thread, args=[self.process.stdout]) self.thread.start() self.display() else: c.notice(nick, "An error occurred while starting the game.") elif 'terp' in cmd or 'emulator' in cmd: c.notice(nick, "Interpreters available:") terplist = list(self.terps.keys()) terplist.sort() for item in terplist: c.notice(nick, item) else: c.notice( nick, "{name} plays interactive fiction. " "To start a game, say '{name}: start [interpreter] [uri]', " "where the interpreter is the optional interpreter to specify, " "(otherwise it goes by extension) and " "the uri is the location of the story file, for example". format(name=self.nickname)) c.notice( nick, "'{name}: start http://mirror.ifarchive.org/if-" "archive/games/zcode/curses.z5'.".format(name=self.nickname)) c.notice( nick, "Quit the game at any time with '{name}: quit'.".format( name=self.nickname)) c.notice( nick, "Get a list of interpreters with '{name}: interpreters.". format(name=self.nickname)) c.notice( nick, "Force this bot to quit and rejoin with '{name}: rejoin'.". format(name=self.nickname))
def on_pubmsg(self, c, e): a = e.arguments()[0].split(":", 1) if len(a) > 1 and irc_lower(a[0]) == irc_lower( self.connection.get_nickname()): self.do_command(e, a[1].strip()) return
def has_key(self, key): return irc_lower(key) in self.canon_keys
def i_am_mentioned(self, c, msg): msg = irc_lower(msg) mynick = irc_lower(c.get_nickname()) pat = r"\b" + mynick + r"\b" return re.search(pat, msg)
def __contains__(self, key): return irc_lower(key) in self.canon_keys
def on_pubmsg(self, c, e): n, c, msg = e.arguments()[0].partition(":") msg = msg.strip() if msg and irc_lower(n) == irc_lower(self.connection.get_nickname()): self.do_command(e, msg)
def on_pubmsg(self, c, e): n, c, msg = e.arguments()[0].partition(":") msg = msg.strip() if msg and irc_lower(n) == irc_lower(self.connection.get_nickname()): print 'Targetted pubmsg: %s' % msg
def has_key(self, key): return self.canon_keys.has_key(irc_lower(key))