[Audio] Remove players which no longer have a guild. #2414

Merged
mikeshardmind merged 4 commits from audio-guild-leave-player into V3/develop 2019-02-16 01:15:34 +01:00
mikeshardmind commented 2019-02-04 18:20:45 +01:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Cleanup players when the bot has one for a guild it leaves.

### Type - [X] Bugfix - [ ] Enhancement - [ ] New feature ### Description of the changes Cleanup players when the bot has one for a guild it leaves.
Twentysix26 (Migrated from github.com) reviewed 2019-02-04 18:20:45 +01:00
PredaaA commented 2019-02-09 21:53:57 +01:00 (Migrated from github.com)

I tested this PR, but I've this error when the bot quit a guild.

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove
    for y in {g.voice_channels for g in self.bot.guilds}
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp>
    for y in {g.voice_channels for g in self.bot.guilds}
TypeError: unhashable type: 'list'
[09/Feb/2019 14:45:29] ERROR - Exception in guild_remove
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove
    for y in {g.voice_channels for g in self.bot.guilds}
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp>
    for y in {g.voice_channels for g in self.bot.guilds}
TypeError: unhashable type: 'list'
I tested this PR, but I've this error when the bot quit a guild. ```[09/02/2019 14:45] ERROR events on_error 196: Exception in guild_remove Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event await coro(*args, **kwargs) File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove for y in {g.voice_channels for g in self.bot.guilds} File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp> for y in {g.voice_channels for g in self.bot.guilds} TypeError: unhashable type: 'list' [09/Feb/2019 14:45:29] ERROR - Exception in guild_remove Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event await coro(*args, **kwargs) File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove for y in {g.voice_channels for g in self.bot.guilds} File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp> for y in {g.voice_channels for g in self.bot.guilds} TypeError: unhashable type: 'list'
mikeshardmind commented 2019-02-09 22:29:20 +01:00 (Migrated from github.com)

I tested this PR, but I've this error when the bot quit a guild.

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove
    for y in {g.voice_channels for g in self.bot.guilds}
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp>
    for y in {g.voice_channels for g in self.bot.guilds}
TypeError: unhashable type: 'list'
[09/Feb/2019 14:45:29] ERROR - Exception in guild_remove
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove
    for y in {g.voice_channels for g in self.bot.guilds}
  File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp>
    for y in {g.voice_channels for g in self.bot.guilds}
TypeError: unhashable type: 'list'

🤦‍♂️ Fixed.

> > > I tested this PR, but I've this error when the bot quit a guild. > > ``` > Traceback (most recent call last): > File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event > await coro(*args, **kwargs) > File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove > for y in {g.voice_channels for g in self.bot.guilds} > File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp> > for y in {g.voice_channels for g in self.bot.guilds} > TypeError: unhashable type: 'list' > [09/Feb/2019 14:45:29] ERROR - Exception in guild_remove > Traceback (most recent call last): > File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 230, in _run_event > await coro(*args, **kwargs) > File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in on_guild_remove > for y in {g.voice_channels for g in self.bot.guilds} > File "C:\Users\Administrator\Desktop\cogs_modified\audio\audio.py", line 3195, in <setcomp> > for y in {g.voice_channels for g in self.bot.guilds} > TypeError: unhashable type: 'list' > ``` :man_facepalming: Fixed.
PredaaA (Migrated from github.com) reviewed 2019-02-10 15:34:11 +01:00
PredaaA (Migrated from github.com) left a comment

I have tested it and it works well now.

I have tested it and it works well now.
Tobotimus (Migrated from github.com) reviewed 2019-02-15 22:41:25 +01:00
@ -2667,3 +2667,20 @@ class Audio(commands.Cog):
self._cleaned_up = True
Tobotimus (Migrated from github.com) commented 2019-02-15 22:41:25 +01:00

You can bump the version of red-lavalink to 0.2.2 in setup.cfg and use player.destroy() if you'd like

You can bump the version of red-lavalink to 0.2.2 in setup.cfg and use `player.destroy()` if you'd like
Tobotimus (Migrated from github.com) approved these changes 2019-02-16 01:14:34 +01:00
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!2414
No description provided.