[Audio] Fix trying to send notify message with no channel object #6429
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!6429
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-notify-no-channel"
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
A user in Red support submitted this traceback.
The player object has a channel reference inside the extra information telling it where to display messages and the channel was deleted or unreachable. This change checks for a channel object before trying to fetch its permissions.
Have the changes in this PR been tested?
Yesn't
I tested this change and checked for the _has_notify_perms condition returning False when an audioset notify channel is set to a deleted channel. After this change the player continues playing without throwing an error when a track changes and a notify message or autoplay message needs to be sent. There are a lot of points where interacting with audio and sending a command will readjust the notify channel saved in the player, so there isn't much of a need to clear that non-existent channel object as it will do it on its own with most usage.
If someone else would like to do any kind of sanity check on this please feel free. Otherwise I'm mostly confident I didn't break more things. 🤞
booltoOptional[bool]and it's arguable whether it's more logical to return true or false from this function.channelargument already did not allowNone. Presumably, this was intentional and the issue should be fixed at the call site instead. All but one of the calls to this method already check that the notify channel is not None before calling the method. The outlier can be found at:github.com/Cog-Creators/Red-DiscordBot@903992f48a/redbot/cogs/audio/core/events/cog.py (L201)LGTM.