Esempio n. 1
0
 async def addboss(self, ctx, term, *, definition):
     """Adds a set of boss mechanics.
     If you want to use a multiple word boss name, enclose it in quotes."""
     term = term.lower()
     op = 'EDITED' if term in self.settings.boss() else 'ADDED'
     definition = clean_global_mentions(definition)
     definition = definition.replace(u'\u200b', '')
     definition = replace_emoji_names_with_code(self._get_emojis(), definition)
     self.settings.addBoss(term, definition)
     await ctx.send("PAD boss mechanics successfully {}.".format(op))
Esempio n. 2
0
    async def addglossary(self, ctx, term, *, definition):
        """Adds a term to the glossary.
        If you want to use a multiple word term, enclose it in quotes.

        e.x. [p]padglobal addglossary alb Awoken Liu Bei
        e.x. [p]padglobal addglossary "never dathena" NA will never get dathena
        """
        term = term.lower()
        definition = clean_global_mentions(definition)
        definition = definition.replace(u'\u200b', '')
        definition = replace_emoji_names_with_code(self._get_emojis(), definition)

        op = 'EDITED' if term in self.settings.glossary() else 'ADDED'
        self.settings.addGlossary(term, definition)
        await ctx.send("PAD glossary term successfully {}.".format(op))
Esempio n. 3
0
    async def _add(self, ctx, command, text, confirm=True):
        command = command.lower()
        text = clean_global_mentions(text)
        text = text.replace(u'\u200b', '')
        text = replace_emoji_names_with_code(self._get_emojis(), text)
        if command in self.bot.all_commands.keys():
            await ctx.send("That is already a standard command.")
            return

        for c in list(BLACKLISTED_CHARACTERS) + [ctx.prefix]:
            if c in command:
                await ctx.send("Invalid character in name: {}".format(c))
                return

        if not self.c_commands:
            self.c_commands = {}

        if text in self.c_commands:
            op = 'ALIASED'
            if self.c_commands[text] in self.c_commands:
                await ctx.send("You cannot alias an alias")
                return
        elif command in self.c_commands:
            op = 'EDITED'
            ted = self.c_commands[command]
            alias = False
            while ted in self.c_commands:
                ted = self.c_commands[ted]
                alias = True
            if confirm:
                conf = await confirm_message(ctx,"Are you sure you want to edit the {}command {}?" \
                                                .format("alias to " if alias else "", ted))
                if not conf:
                    return
        else:
            op = 'ADDED'

        self.c_commands[command] = text
        json.dump(self.c_commands, open(self.file_path, 'w+'))
        await ctx.send("PAD command successfully {}.".format(op))
Esempio n. 4
0
 async def say(self, ctx, *, text: str):
     """Test a padglobal command with emoji replacements."""
     text = replace_emoji_names_with_code(self._get_emojis(), text)
     await ctx.send(text)