mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-11-25 02:01:28 +00:00
Fix voice state update issue in on_voice_state_update
Bug was caused to the shallow copy not copying over the VoiceState information embedded into the copy. This would mean that when the event is called, before and after voice state information is essentially equivalent. The solution to fix this is to also copy the VoiceState objects.
This commit is contained in:
@@ -31,7 +31,6 @@ from .game import Game
|
||||
from .channel import Channel
|
||||
from .enums import ServerRegion, Status
|
||||
from .mixins import Hashable
|
||||
import copy
|
||||
|
||||
class Server(Hashable):
|
||||
"""Represents a Discord server.
|
||||
@@ -137,8 +136,9 @@ class Server(Hashable):
|
||||
def _update_voice_state(self, data):
|
||||
user_id = data.get('user_id')
|
||||
member = self.get_member(user_id)
|
||||
before = copy.copy(member)
|
||||
before = None
|
||||
if member is not None:
|
||||
before = member._copy()
|
||||
ch_id = data.get('channel_id')
|
||||
channel = self.get_channel(ch_id)
|
||||
member._update_voice_state(voice_channel=channel, **data)
|
||||
|
||||
Reference in New Issue
Block a user