Exemplo n.º 1
0
    async def roles(self, ctx: utils.Context):
        """
        Run the bot setup.
        """

        # Create settings menu
        key_display_function = lambda k: getattr(ctx.guild.get_role(k),
                                                 'mention', 'none')
        menu = utils.SettingsMenuIterableBase(
            cache_key='role_gain',
            key_display_function=key_display_function,
            value_display_function=str)
        menu.add_convertable_value("What activity role would you like to add?",
                                   commands.RoleConverter)
        menu.add_convertable_value(
            "How many tracked messages does a user have to send over 7 days to get that role?",
            int)
        menu.iterable_add_callback = utils.SettingsMenuOption.get_set_iterable_add_callback(
            table_name="role_list",
            column_name="role_id",
            cache_key="role_gain",
            database_key="RoleGain")
        menu.iterable_delete_callback = utils.SettingsMenuOption.get_set_iterable_delete_callback(
            table_name="role_list",
            column_name="role_id",
            cache_key="role_gain",
            database_key="RoleGain")
        await menu.start(ctx)
Exemplo n.º 2
0
    async def blacklistedchannels(self, ctx:utils.Context):
        """
        Run the bot setup.
        """

        # Create settings menu
        key_display_function = lambda k: getattr(ctx.bot.get_channel(k), 'mention', 'none')
        menu = utils.SettingsMenuIterableBase(cache_key='blacklisted_channels', key_display_function=key_display_function)
        menu.add_convertable_value("What channel would you like to blacklist?", commands.TextChannelConverter)
        menu.iterable_add_callback = utils.SettingsMenuOption.get_set_iterable_add_callback(
            table_name="channel_list", column_name="channel_id", cache_key="blacklisted_channels", database_key="BlacklistedChannel"
        )
        menu.iterable_delete_callback = utils.SettingsMenuOption.get_set_iterable_delete_callback(
            table_name="channel_list", column_name="channel_id", cache_key="blacklisted_channels", database_key="BlacklistedChannel"
        )
        await menu.start(ctx)
Exemplo n.º 3
0
    async def rolemultipliers(self, ctx:utils.Context):
        """
        Run the bot setup.
        """

        # Create settings menu
        key_display_function = lambda k: getattr(ctx.guild.get_role(k), 'mention', 'none')
        menu = utils.SettingsMenuIterableBase(cache_key='role_multiplier', key_display_function=key_display_function, value_display_function=str, default_type=dict)
        menu.add_convertable_value("What role would you like to add a multiplier to?", commands.RoleConverter)
        menu.add_convertable_value("How many points per message? `default: 1`", float)
        menu.iterable_add_callback = utils.SettingsMenuOption.get_set_iterable_add_callback(
            table_name="role_list", column_name="role_id", cache_key="role_multiplier", database_key="RoleMultiplier"
        )
        menu.iterable_delete_callback = utils.SettingsMenuOption.get_set_iterable_delete_callback(
            table_name="role_list", column_name="role_id", cache_key="role_multiplier", database_key="RoleMultiplier"
        )
        await menu.start(ctx)