Ejemplo n.º 1
0
    async def add_commands(self, slash: SlashCommand):
        slash.add_slash_command(
            self.database_command,
            name=self.configuration.get("command_prefix", "") +
            "database-inspect",
            description=
            "Consult the Randovania's logic database for one specific room.",
            guild_ids=None,
            options=[
                manage_commands.create_option(
                    "game",
                    "The game's database to check.",
                    option_type=SlashCommandOptionType.STRING,
                    required=True,
                    choices=[
                        manage_commands.create_choice(game.value,
                                                      game.long_name)
                        for game in enum_lib.iterate_enum(RandovaniaGame)
                    ])
            ],
        )

        def add_id(custom_id: str, call, **kwargs):
            self._on_database_component_listener[
                custom_id] = functools.partial(call, **kwargs)

        for game in enum_lib.iterate_enum(RandovaniaGame):
            db = default_database.game_description_for(game)
            world_options = await create_split_worlds(db)
            self._split_worlds[game] = world_options

            add_id(f"{game.value}_world",
                   self.on_database_world_selected,
                   game=game)
            add_id(f"back_to_{game.value}",
                   self.on_database_back_to_game,
                   game=game)

            for i, split_world in enumerate(world_options):
                add_id(f"{game.value}_world_{i}",
                       self.on_database_area_selected,
                       game=game,
                       split_world=split_world,
                       world_id=i)
                for j, area in enumerate(split_world.areas):
                    add_id(f"{game.value}_world_{i}_area_{j}",
                           self.on_area_node_selection,
                           game=game,
                           area=area)

        slash.add_component_callback(
            self.on_database_component,
            components=list(self._on_database_component_listener.keys()),
            use_callback_name=False,
        )
Ejemplo n.º 2
0
 async def add_commands(self, slash: SlashCommand):
     slash.add_component_callback(
         self.on_request_presets,
         components=["attach_presets_of_permalink"],
         use_callback_name=False,
     )
Ejemplo n.º 3
0
    ]

    action_row1 = create_actionrow(*buttons1)
    action_row2 = create_actionrow(*buttons2)
    action_row3 = create_actionrow(*buttons3)
    action_row4 = create_actionrow(*buttons4)
    await ctx.edit_origin(
        components=[action_row1, action_row2, action_row3, action_row4])


#slash.add_component_callback(some_callback,components=["green","grey"],use_callback_name=False)
btns = ["btn_" + str(i) for i in range(10)]
btns.extend(["btn_go"])
print(btns)
slash.add_component_callback(on_component,
                             components=btns,
                             use_callback_name=False)
slash.add_component_callback(min_keypad,
                             components=["btn_no"],
                             use_callback_name=False)
slash.add_component_callback(max_keypad,
                             components=["expand_keypad"],
                             use_callback_name=False)

# Load all of the cogs made in the other python files in this
# project. See the other files in the folder for more details
bot.add_cog(command_basics.general(bot))
bot.add_cog(referral_cog.referrals(bot))
bot.add_cog(debug_cog.debug(bot))
bot.add_cog(webhooks_cog.webhooks(bot))