Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from Feb 16, 2019
Merged

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

merged 4 commits into from Feb 16, 2019

Conversation

mikeshardmind
Copy link
Contributor

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

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

@PredaaA
Copy link
Member

PredaaA commented Feb 9, 2019

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'

@mikeshardmind
Copy link
Contributor Author

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.

Copy link
Member

@PredaaA PredaaA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it and it works well now.

# Can result in iterator changing size during context switching.
for zombie in zombie_players:
await zombie.disconnect()
lavalink.player_manager.players.remove(zombie)
Copy link
Member

@Tobotimus Tobotimus Feb 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Tobotimus Tobotimus self-assigned this Feb 15, 2019
@Tobotimus Tobotimus added QA: Changes Requested Used by few QA members. Awaiting changes requested by maintainers or QA. Type: Fix and removed QA: Unassigned labels Feb 15, 2019
@Tobotimus Tobotimus added QA: Passed Used by few QA members. Has been approved by the assigned QA member(s). Backport to: 3.0 and removed QA: Changes Requested Used by few QA members. Awaiting changes requested by maintainers or QA. labels Feb 16, 2019
@Tobotimus Tobotimus merged commit 4b831a6 into Cog-Creators:V3/develop Feb 16, 2019
Tobotimus pushed a commit that referenced this pull request Feb 16, 2019
Cleanup players when the bot has one for a guild it leaves.

Bumps Red-Lavalink to v0.2.2
@mikeshardmind mikeshardmind deleted the audio-guild-leave-player branch December 26, 2019 17:06
@Jackenmen Jackenmen added this to the 3.0.1 milestone Nov 17, 2020
@Jackenmen Jackenmen added the Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA: Passed Used by few QA members. Has been approved by the assigned QA member(s). Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants