Esempio n. 1
0
 async def admin_item_type_autocomplete(
         ctx: discord.AutocompleteContext):
     return autocomplete_match(
         ctx.value,
         list(
             map(lambda x: 'ID: {} Name: {}'.format(x.id, x.name),
                 self.bot.db.get_item_types(ctx.interaction.guild.id))))
Esempio n. 2
0
 async def reaction_trigger_autocomplete(
         ctx: discord.AutocompleteContext):
     return autocomplete_match(
         ctx.value,
         list(
             map(
                 lambda x: x.trigger,
                 self.bot.db.get_message_reactions(
                     ctx.interaction.guild.id))))
Esempio n. 3
0
 async def equip_item_autocomplete(ctx: discord.AutocompleteContext):
     return autocomplete_match(
         ctx.value,
         list(
             map(
                 lambda item: 'ID: {} Rarity: {} Name: {} Amount: {:g}'.
                 format(item.InventoryItemType.id, item.InventoryRarity.
                        name, item.InventoryItemType.name, item.
                        UserInventoryItem.amount),
                 self.bot.db.get_user_equippable_items(
                     ctx.interaction.guild.id,
                     ctx.interaction.user.id))))
Esempio n. 4
0
        async def remove_emoji_reaction_autocomplete(
                ctx: discord.AutocompleteContext):
            reactions = []
            for reaction in self.bot.db.get_emoji_reactions(
                    ctx.interaction.guild.id):
                val = 'Not Found'
                if reaction.action_type == self.ADD_ROLE or reaction.action_type == self.TRIGGER_ROLE:
                    r = ctx.interaction.guild.get_role(int(reaction.action))
                    if r is not None:
                        val = r.name
                elif reaction.action_type == self.SEND_DM:
                    val = json.dumps(reaction.action if len(reaction.action) <
                                     20 else reaction.action[:20] + '...')

                reactions.append('ID: {} | {} | {} | {}'.format(
                    reaction.id,
                    discord.PartialEmoji.from_str(reaction.emoji).name,
                    self.bot.i18n.get(
                        self.reaction_types[reaction.action_type]), val))

            return tools.autocomplete_match(ctx.value, reactions)
Esempio n. 5
0
 async def setting_key_autocomplete(ctx: discord.AutocompleteContext):
     return autocomplete_match(
         ctx.value,
         self.bot.module_manager.settings.keys(
             ctx.interaction.guild.id))
Esempio n. 6
0
 async def deactivate_module_autocomplete(
         ctx: discord.AutocompleteContext):
     return autocomplete_match(
         ctx.value,
         self.bot.module_manager.get_deactivatable_modules(
             ctx.interaction.guild.id))