Exemplo n.º 1
0
    def wiki(self, mask, target, args):
        """Link to a wiki page

            %%wiki
            %%wiki <argument>
        """
        try:
            self.bot.privmsg(target, WIKI_LINKS_SYNONYMES[args['<argument>']])
            return
        except:
            pass

        try:
            self.bot.privmsg(target, WIKI_LINKS[args['<argument>']])
        except:
            if self.spam_protect('wiki', mask, target, args):
                return

            msg = ""
            if not args['<argument>'] is None:
                msg = "Unknown wiki link: \"" + args['<argument>'] + "\". Do you mean one of these: "
            else:
                msg = LINKS["wiki"] + " For better matches try !wiki " 
            isFirst = True
            for key in WIKI_LINKS.keys():
                if not isFirst:
                    msg += " / "
                isFirst = False
                msg += key
            if not args['<argument>'] is None:
                msg += " ?"
            self.bot.privmsg(target, msg)
Exemplo n.º 2
0
    def wiki(self, mask, target, args):
        """Link to a wiki page

            %%wiki
            %%wiki <argument>
            %%wiki <argument> WORDS...
        """
        try:
            self.bot.privmsg(target, WIKI_LINKS_SYNONYMES[args['<argument>']])
            return
        except:
            pass

        try:
            self.bot.privmsg(target, WIKI_LINKS[args['<argument>']])
        except:
            if self.spam_protect('wiki', mask, target, args):
                return

            msg = ""
            if not args['<argument>'] is None:
                msg = "Unknown wiki link: \"" + args[
                    '<argument>'] + "\". Do you mean one of these: "
            else:
                msg = LINKS["wiki"] + " For better matches try !wiki "
            msg += " / ".join(WIKI_LINKS.keys())
            if not args['<argument>'] is None:
                msg += " ?"
            self.bot.privmsg(target, msg)