コード例 #1
0
ファイル: padglobal.py プロジェクト: muffin-rice/padbot-cogs
 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))
コード例 #2
0
ファイル: padglobal.py プロジェクト: muffin-rice/padbot-cogs
 def emojify(self, message):
     emojis = list()
     emoteservers = self.settings.emojiServers()
     for guild in emoteservers:
         if self.bot.get_guild(int(guild)):
             emojis.extend(self.bot.get_guild(int(guild)).emojis)
     for guild in self.bot.guilds:
         if guild.id in emoteservers:
             continue
         emojis.extend(guild.emojis)
     message = tsutils.replace_emoji_names_with_code(emojis, message)
     return tsutils.fix_emojis_for_server(emojis, message)
コード例 #3
0
ファイル: padglobal.py プロジェクト: muffin-rice/padbot-cogs
    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))
コード例 #4
0
ファイル: padglobal.py プロジェクト: muffin-rice/padbot-cogs
    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))
コード例 #5
0
ファイル: fancysay.py プロジェクト: turtleworks/misc-cogs
 def emojify(self, message):
     emojis = list()
     for guild in self.bot.guilds:
         emojis.extend(guild.emojis)
     message = replace_emoji_names_with_code(emojis, message)
     return fix_emojis_for_server(emojis, message)
コード例 #6
0
ファイル: padglobal.py プロジェクト: muffin-rice/padbot-cogs
 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)