[V3] enforce commands as ours #1971
No reviewers
Labels
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 project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!1971
Loading…
Reference in a new issue
No description provided.
Delete branch "enforce-commands"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
Prevents cogs not using our command module from being added (#1880)
Why in cog load
Rather than do this at the command level, it makes more sense to do at the cog level to prevent the cog from even being partially added.
Forgive me but why is it important to use your system and not the built in ?
@useruser3 It's true that this change (especially being a breaking one) deserves some more explanation. I've opened #1972 to shed some light here and perhaps open up some discussion if necessary.
I think this is a good change. If anything, it helps curb the muscle memory of always using discord.ext. My recommendation is to include a blurb in the docs the reasoning behind why we subclassed
commands.Command. While on this topic, it might be beneficial to have a section of all Red specific utilities that should be used over standard d.py.More on the last point by @redjumpman we have a cog cookiecutter repo which will be documented soon to help alleviate any adjustments like this for new cog creators as well
Running this currently results in a
TypeErrorTypeError: isinstance() arg 2 must be a type or tuple of types.I tried calling
type()on attr and the return ofgetattrand was able to get it to move past that error. I think because when iterating over dir, not everything is returned as a type.However, this does get the runtime error to raise, but I think unexpectedly for the one time we need it.
RuntimeError: redbot.core.core_commands is not using Red's command module, and cannot be added.This should be working all the time now, rather than only in the small toy test case I was using for it before.
cog.__class__.__nameshould becog.__class__.__name__otherwise it raises an attribute error.After the change I marked is fixed, the message reports as
RuntimeError: RussianRoulette from russianroulette.russianroulette, is not using Red's command module, and cannot be add ed.I think this could be written a little more clearly as "The RussianRoulette cog in the russianroulette.russianroulette package must use from redbot.core import commands, instead of from discord.ext import commands." Something along those lines.@Redjumpman Sorry, I feel like an idiot after that last minute change to give more detailed errors. That's been fixed, and I've added a documentation link to the error, along with a slight tweak to the documentation making it clear that we have additional methods there for red specific things.
Awesome. Everything works great. This is now ready for the next release.
Thanks for reviewing @Redjumpman, but considering this is a breaking change we haven't announced for yet, and beta 19 being due this Sunday August 12, I'm going to block this until after beta 19.