Skip to content

Conversation

cswimr
Copy link
Contributor

@cswimr cswimr commented Feb 1, 2025

Description of the changes

This PR adds an argument to redbot that takes a list of strings (can be used multiple times for more than one value), validates that the path provided exists, and adds the path via self._cog_mgr.add_path(), so that cogs can be loaded from that path.

Closes #6506

Have the changes in this PR been tested?

Not thoroughly

@github-actions github-actions bot added Category: Core - Bot Class This is related to the `redbot.core.bot.Red` class. Category: Core - Command-line Interfaces This is related to Red's CLIs (redbot, redbot-launcher, redbot-setup). labels Feb 1, 2025
@Flame442
Copy link
Member

Flame442 commented Aug 9, 2025

This PR does not behave as outlined in the issue. self._cog_mgr.add_path() is the method used by [p]addpath to add a new permanent cog path to the bot. The issue described this flag as a temporary path which would only exist as long as the path was present. The method does not duplicate paths, so it is not a huge problem, but if we want this flag to specifically be for temporary paths then a new method for doing so will be needed.

@cswimr
Copy link
Contributor Author

cswimr commented Aug 19, 2025

Oops, good catch! I'll take another look at this.

This argument takes a list of strings (can be used multiple times for more than one value), validates that the path provided exists, and adds the path via `self._cog_mgr.add_path()`, so that cogs can be loaded from that path.

Closes Cog-Creators#6506
@cswimr
Copy link
Contributor Author

cswimr commented Aug 20, 2025

So, I propose the following:
Temporary paths would be stored in config, separately from ones added via [p]addpath. This is the safest place that I can think of to store them. When the bot is started, that config value would be overwritten with the contents (if any) of the --cog-path CLI argument. If nothing is passed to --cog-path, then the config value is emptied. A new function would have to be added to CogManager to retrieve these temporary paths, and CogManagerUI would have to be updated to check this in [p]paths. Is there a better way Red has to do something like this? It feels kind of clunky imo but it'd work I think.

@Flame442
Copy link
Member

Why not just store it in memory during the run the flag is used? Why does the disk need to be used at all?

@Jackenmen Jackenmen modified the milestones: 3.5.21, 3.5.22 Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Core - Bot Class This is related to the `redbot.core.bot.Red` class. Category: Core - Command-line Interfaces This is related to Red's CLIs (redbot, redbot-launcher, redbot-setup). Type: Feature New feature or request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CLI argument to redbot to add cog paths to [p]paths

4 participants