Add basic backcompat for people using Downloader internals #6713

Merged
Jackenmen merged 1 commit from add_some_back_compat into V3/develop 2026-04-08 00:17:12 +02:00
Jackenmen commented 2026-03-29 23:33:58 +02:00 (Migrated from github.com)

Description of the changes

This PR readds internals that are commonly used by 3rd-party cogs, which were removed by #6706. This covers the majority of use with minimal work for us.

Have the changes in this PR been tested?

No

### Description of the changes This PR readds internals that are commonly used by 3rd-party cogs, which were removed by #6706. This covers the majority of use with minimal work for us. ### Have the changes in this PR been tested? No
Jackenmen commented 2026-03-29 23:38:38 +02:00 (Migrated from github.com)

For future reference, here's a script for finding cogs in the Index that are affected by the changes in this PR:

check_6706.py
import re
from pathlib import Path

total_repo_count = 0
total_cog_count = 0
repo_count = 0
cog_count = 0


for repo_path in Path("cache").iterdir():
    if not repo_path.is_dir():
        continue
    total_repo_count += 1
    repo_name, *_ = repo_path.name.rpartition("_")
    repo_matches = {}
    for cog_path in repo_path.iterdir():
        total_cog_count += 1
        if not cog_path.is_dir():
            continue

        pattern = re.compile(
            r"from redbot.cogs.downloader[^ ]* +import"
            r"|from redbot.cogs +import +downloader"
            r"|\.get_cog *\( *['\"]Downloader['\"] *\)"
        )
        cog_matches = {}
        for file in cog_path.rglob("*.py"):
            with file.open(encoding="utf-8") as fp:
                for match in pattern.finditer(fp.read()):
                    file_matches = cog_matches.setdefault(file.relative_to(cog_path), [])
                    file_matches.append(match)
        if cog_matches:
            cog_count += 1
            repo_matches[cog_path.name] = cog_matches

    if repo_matches:
        repo_count += 1
        print("Found matches in", repo_name)
        for cog_name, cog_matches in repo_matches.items():
            print(f'  - Cog "{cog_name}":')
            for file, file_matches in cog_matches.items():
                print(f'    - File "{file}":')
                for match in file_matches:
                    print(f"      {match.group()}")


print()
print(
    f"{repo_count} repos out of {total_repo_count}"
    f" ({repo_count / total_repo_count * 100:.2f}%) affected"
)
print(
    f"{cog_count} cogs out of {total_cog_count}"
    f" ({cog_count / total_cog_count * 100:.2f}%) affected"
)

The results I got are (excluding specific file lines):

Found matches in Trusty-cogs
  - Cog "timestamp"
  - Cog "roletools"
  - Cog "hockey"
  - Cog "destiny"
  - Cog "runescape"
  - Cog "automod"
  - Cog "spotify"
  - Cog "retrigger"
  - Cog "citation"
Found matches in Kuro-Cogs
  - Cog "kurotools"
Found matches in Flare-Cogs
  - Cog "commandstats"
Found matches in mr42-cogs
  - Cog "repolist"
Found matches in FluffyCogs
  - Cog "rtfs"
Found matches in Toxic-Cogs
  - Cog "dashboard"
  - Cog "updatechecker"
Found matches in x26-Cogs
  - Cog "index"
Found matches in AAA3A-cogs
  - Cog "dashboard"
  - Cog "dev"
Found matches in vrt-cogs
  - Cog "vrtutils"
9 repos out of 68 (13.24%) affected
19 cogs out of 1579 (1.20%) affected

After this PR is merged, based on my evaluation, these are the only 2 cogs that remain affected:

Found matches in Toxic-Cogs
  - Cog "updatechecker":
    - File "updatechecker.py":
      from redbot.cogs.downloader.repo_manager import
      .get_cog("Downloader")
Found matches in vrt-cogs
  - Cog "vrtutils":
    - File "commands/updates.py":
      from redbot.cogs.downloader.converters import
      .get_cog("Downloader")
      .get_cog("Downloader")
For future reference, here's a script for finding cogs in the Index that are affected by the changes in this PR: <details> <summary>check_6706.py</summary> ```py import re from pathlib import Path total_repo_count = 0 total_cog_count = 0 repo_count = 0 cog_count = 0 for repo_path in Path("cache").iterdir(): if not repo_path.is_dir(): continue total_repo_count += 1 repo_name, *_ = repo_path.name.rpartition("_") repo_matches = {} for cog_path in repo_path.iterdir(): total_cog_count += 1 if not cog_path.is_dir(): continue pattern = re.compile( r"from redbot.cogs.downloader[^ ]* +import" r"|from redbot.cogs +import +downloader" r"|\.get_cog *\( *['\"]Downloader['\"] *\)" ) cog_matches = {} for file in cog_path.rglob("*.py"): with file.open(encoding="utf-8") as fp: for match in pattern.finditer(fp.read()): file_matches = cog_matches.setdefault(file.relative_to(cog_path), []) file_matches.append(match) if cog_matches: cog_count += 1 repo_matches[cog_path.name] = cog_matches if repo_matches: repo_count += 1 print("Found matches in", repo_name) for cog_name, cog_matches in repo_matches.items(): print(f' - Cog "{cog_name}":') for file, file_matches in cog_matches.items(): print(f' - File "{file}":') for match in file_matches: print(f" {match.group()}") print() print( f"{repo_count} repos out of {total_repo_count}" f" ({repo_count / total_repo_count * 100:.2f}%) affected" ) print( f"{cog_count} cogs out of {total_cog_count}" f" ({cog_count / total_cog_count * 100:.2f}%) affected" ) ``` </details> The results I got are (excluding specific file lines): ``` Found matches in Trusty-cogs - Cog "timestamp" - Cog "roletools" - Cog "hockey" - Cog "destiny" - Cog "runescape" - Cog "automod" - Cog "spotify" - Cog "retrigger" - Cog "citation" Found matches in Kuro-Cogs - Cog "kurotools" Found matches in Flare-Cogs - Cog "commandstats" Found matches in mr42-cogs - Cog "repolist" Found matches in FluffyCogs - Cog "rtfs" Found matches in Toxic-Cogs - Cog "dashboard" - Cog "updatechecker" Found matches in x26-Cogs - Cog "index" Found matches in AAA3A-cogs - Cog "dashboard" - Cog "dev" Found matches in vrt-cogs - Cog "vrtutils" 9 repos out of 68 (13.24%) affected 19 cogs out of 1579 (1.20%) affected ``` After this PR is merged, based on my evaluation, these are the only 2 cogs that remain affected: ``` Found matches in Toxic-Cogs - Cog "updatechecker": - File "updatechecker.py": from redbot.cogs.downloader.repo_manager import .get_cog("Downloader") Found matches in vrt-cogs - Cog "vrtutils": - File "commands/updates.py": from redbot.cogs.downloader.converters import .get_cog("Downloader") .get_cog("Downloader") ```
Jackenmen commented 2026-03-30 00:09:19 +02:00 (Migrated from github.com)

Breakage for vrtutils mentioned in the previous message should be fixed by https://github.com/vertyco/vrt-cogs/pull/269
Breakage for updatechecker will remain unfixed because, as far as I know, the Toxic-cogs repository is no longer maintained.

Breakage for `vrtutils` mentioned in the previous message should be fixed by https://github.com/vertyco/vrt-cogs/pull/269 Breakage for `updatechecker` will remain unfixed because, as far as I know, the Toxic-cogs repository is no longer maintained.
Flame442 (Migrated from github.com) approved these changes 2026-04-08 00:16:59 +02:00
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!6713
No description provided.