Ejemplo 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))
Ejemplo n.º 2
0
    async def mycommand(self, ctx, command: str, *, text: str):
        """Sets your custom command (donor only)."""
        user_id = ctx.author.id
        text = clean_global_mentions(text)
        if user_id not in self.settings.donors():
            await ctx.send(inline('Only donors can set a personal command'))
            return

        self.settings.addCustomCommand(user_id, command, text)
        await ctx.send(inline('I set up your command: ' + command))
Ejemplo n.º 3
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))
Ejemplo n.º 4
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))
Ejemplo n.º 5
0
    async def mycommand(self, ctx, command: str, *, text: str):
        """Sets your custom command."""
        text = clean_global_mentions(text)

        self.settings.addCustomCommand(ctx.author.id, command, text)
        await ctx.send(inline('I set up your command: ' + command))