[CustomCom] Add last_editor in [p]cc show and add the alias [p]cc info to this command. #6216
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!6216
Loading…
Reference in a new issue
No description provided.
Delete branch "AAA3A-AAA3A/patch-11"
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?
Description of the changes
Hello,
This PR adds the last editor of a CC to the output of the
[p]cc showcommand. If the CC was created before this PR was merged, the cog will useeditors[-1]. This allows the author of a CC to know who modified it and to check before removing a change.This PR also adds the alias
[p]cc infoto this command, as I think this is the command name that comes to mind when you think of "displaying information about a CC".Thanks in advance,
Have a nice day,
AAA3A
Have the changes in this PR been tested?
Yes
Pull request overview
This pull request enhances the CustomCommands cog by exposing “last editor” information in the
[p]cc showoutput and adding a more discoverable alias for the command.Changes:
last_editormetadata when a custom command is edited.Last editorin[p]cc show, with a fallback toeditors[-1]for older commands.[p]cc infoas an alias of[p]cc show.Comments suppressed due to low confidence (1)
redbot/cogs/customcom/customcom.py:629
elif cmd.get("last_editor"):branch, the code assigns toauthorinstead oflast_editor, which can also leavelast_editorundefined and crash when formatting the output (e.g., when the last editor is no longer in the guild). This branch should set thelast_editordisplay string instead.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -74,0 +74,4 @@if com_info.get("last_editor", {}).get("id", 0) == user_id:com_info["last_editor"]["id"] = 0xDE1com_info["last_editor"]["name"] = "Deleted User"com_info.get("last_editor", {}).get("id", 0)will raise an AttributeError whenlast_editoris present but set toNone(as in newly-created CCs). Please guard againstNone(e.g., treat non-dict/None as{}) before calling.get()and before writing intocom_info["last_editor"][...].This issue also appears on line 625 of the same file.
I feel that it would be better for us to handle this entirely through the
editorslist rather than special-case the last editor - i.e. have a migration that changeseditorsfrom a list of IDs to a list of dictionaries in the form of:{"id": 123, "name": None}and update the implementation to append new editor as{"id: editor.id, "name": str(editor)}or, if they're already on the list, move them to the end (essentially making the list be in edit order).