Creating a group of hybrid commands without app_command in a cog causes an error. #5980

Closed
opened 2023-02-09 23:22:37 +01:00 by AAA3A-AAA3A · 1 comment
AAA3A-AAA3A commented 2023-02-09 23:22:37 +01:00 (Migrated from github.com)

What Red version are you using?

3.5.0.dev310+g5e446ad1 (dpy 2.2.0a)

What were you trying to do?

Hello,

I noticed that there was an error when adding a cog with a hybrid command group if there is no app_command, on the latest version of dpy2. As a result, some of my cogs are no longer working.
Recently, some of dpy's private methods have been removed and Red seems to be using them here.
Flame tested the same eval as me in #testing the main server on a non-Red dpy bot and there is no error, so this is in Red.

Thanks in advance,
AAA3A

What did you expect to happen?

The cog should have been added correctly.

What actually happened?

Traceback (most recent call last):
  File "{USERPROFILE}\Documents\GitHub\Red-DiscordBot\redbot\core\dev_commands.py", line 216, in _eval
    result = await func()
  File "<string>", line 8, in func
  File "{USERPROFILE}\redenv\lib\site-packages\discord\ext\commands\cog.py", line 343, in __new__
    app_command = app_command._copy_with(parent=group_parent, binding=self)
AttributeError: '_MissingSentinel' object has no attribute '_copy_with'

How can we reproduce this error?

Run this eval or load a cog with this code:

class Cog(commands.Cog):
    @commands.hybrid_group(with_app_command=False)
    async def test(self, ctx: commands.Context):
        pass
await ctx.bot.remove_cog("Cog")
await ctx.bot.add_cog(Cog())

Anything else?

No response

### What Red version are you using? 3.5.0.dev310+g5e446ad1 (dpy 2.2.0a) ### What were you trying to do? Hello, I noticed that there was an error when adding a cog with a hybrid command group if there is no app_command, on the latest version of dpy2. As a result, some of my cogs are no longer working. Recently, some of dpy's private methods have been removed and Red seems to be using them here. Flame tested the same eval as me in #testing the main server on a non-Red dpy bot and there is no error, so this is in Red. Thanks in advance, AAA3A ### What did you expect to happen? The cog should have been added correctly. ### What actually happened? ``` Traceback (most recent call last): File "{USERPROFILE}\Documents\GitHub\Red-DiscordBot\redbot\core\dev_commands.py", line 216, in _eval result = await func() File "<string>", line 8, in func File "{USERPROFILE}\redenv\lib\site-packages\discord\ext\commands\cog.py", line 343, in __new__ app_command = app_command._copy_with(parent=group_parent, binding=self) AttributeError: '_MissingSentinel' object has no attribute '_copy_with' ``` ### How can we reproduce this error? Run this eval or load a cog with this code: ```py class Cog(commands.Cog): @commands.hybrid_group(with_app_command=False) async def test(self, ctx: commands.Context): pass await ctx.bot.remove_cog("Cog") await ctx.bot.add_cog(Cog()) ``` ### Anything else? _No response_
AAA3A-AAA3A commented 2023-02-11 07:44:53 +01:00 (Migrated from github.com)

Actually it was an error in dpy2.2.0a. My PR was merged this morning on the dpy repo to fix this error.

Actually it was an error in dpy2.2.0a. My PR was merged this morning on the dpy repo to fix this error.
Sign in to join this conversation.
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#5980
No description provided.