[V2] Audio voice fix for channels with user limit #1922

Closed
Jackenmen wants to merge 2 commits from fix-for-1643 into develop
Jackenmen commented 2018-07-08 02:53:13 +02:00 (Migrated from github.com)

Bugfix request

Describe the bug being fixed

When the bot is idle in full channel with user limit, when you were trying to play music with command [p]play (name of song), it was saying "Your voice channel is full."
Fixes #1643

Anything we need to know about this fix?

No, all I did was just adding one if (well changing place of it technically). You used such solution in another function already even, it looks like you forgot to do this here as well.

# Bugfix request <!-- THIS TEMPLATE IS CURRENTLY UNUSED DUE TO GITHUB LIMITATIONS! To be used for pull requests that fix a bug --> #### Describe the bug being fixed When the bot is idle in full channel with user limit, when you were trying to play music with command `[p]play (name of song)`, it was saying "Your voice channel is full." Fixes #1643 #### Anything we need to know about this fix? No, all I did was just adding one if (well changing place of it technically). You used such solution in another function already even, it looks like you forgot to do this here as well.
aikaterna (Migrated from github.com) reviewed 2018-07-08 02:53:13 +02:00
mikeshardmind (Migrated from github.com) requested changes 2018-07-08 03:40:08 +02:00
mikeshardmind (Migrated from github.com) left a comment

I think it makes sense to either modify has_connect_perms to account for the case of already being in the channel with voice perms (As an admin even join after the bot surpassing the channel limit, making calculating an offest wrong too)

or to modify handling of

except ChannelUserLimit:

and handle it there.

I've detailed why the current proposed solution is not quite enough in comments attached.

I think it makes sense to either modify `has_connect_perms` to account for the case of already being in the channel with voice perms (As an admin even join after the bot surpassing the channel limit, making calculating an offest wrong too) or to modify handling of ``` except ChannelUserLimit: ``` and handle it there. I've detailed why the current proposed solution is not quite enough in comments attached.
@ -1514,0 +1509,4 @@
except ChannelUserLimit:
await self.bot.say("Your voice channel is full.")
return
else:
mikeshardmind (Migrated from github.com) commented 2018-07-08 03:28:19 +02:00

This is not the correct condition, or at least not without additional conditions, as the else condition prior existing that you left in place would also pass this condition.

This is not the correct condition, or at least not without additional conditions, as the else condition prior existing that you left in place would also pass this condition.
@ -1514,2 +1512,4 @@
else:
await self._join_voice_channel(voice_channel)
else: # We are connected but not to the right channel
if self.voice_client(server).channel != voice_channel:
mikeshardmind (Migrated from github.com) commented 2018-07-08 03:31:40 +02:00

This line right here (well, specifically the full channel comparison in the function call (github.com/Cog-Creators/Red-DiscordBot@97b70c35ee/cogs/audio.py (L2246)) is the root cause of the issue, as there is no offset if the bot is in the channel, nor an additional pass condition of the bot is in the channel already with speak perms.

This line right here (well, specifically the full channel comparison in the function call (https://github.com/Cog-Creators/Red-DiscordBot/blob/97b70c35ee540710d7172e4fa7f6ac3663a979ea/cogs/audio.py#L2246) is the root cause of the issue, as there is no offset if the bot is in the channel, nor an additional pass condition of the bot is in the channel already with speak perms.
mikeshardmind (Migrated from github.com) commented 2018-07-08 03:36:53 +02:00

Having the else block handled like this means the above permission checking never gets called if you want to bot to switch channels.

Having the else block handled like this means the above permission checking never gets called if you want to bot to switch channels.
Jackenmen commented 2018-07-08 03:55:30 +02:00 (Migrated from github.com)

You're right, though I didn't change what was already there. I just changed place of the code - try clause is now in if, like in other places of this code.

Of course this can be fixed in another pull request, I don't think I should do changes not relevant to the issue I mentioned.

I can try to help with that though, because you're right, that this should check for connecting perms in else clause as well.

You're right, though I didn't change what was already there. I just changed place of the code - try clause is now in if, like in other places of this code. Of course this can be fixed in another pull request, I don't think I should do changes not relevant to the issue I mentioned. I can try to help with that though, because you're right, that this should check for connecting perms in else clause as well.

Pull request closed

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!1922
No description provided.