player.current should be None after a track ends

This commit is contained in:
vveeps 2021-10-26 21:22:06 +03:00
parent fd2d5645fe
commit d344f82325
1 changed files with 5 additions and 1 deletions

View File

@ -14,7 +14,7 @@ from discord.ext import commands
from . import events from . import events
from .enums import SearchType from .enums import SearchType
from .events import PomiceEvent, TrackStartEvent from .events import PomiceEvent, TrackEndEvent, TrackStartEvent
from .exceptions import TrackInvalidPosition from .exceptions import TrackInvalidPosition
from .filters import Filter from .filters import Filter
from .objects import Track from .objects import Track
@ -164,6 +164,10 @@ class Player(VoiceProtocol):
async def _dispatch_event(self, data: dict): async def _dispatch_event(self, data: dict):
event_type = data.get("type") event_type = data.get("type")
event: PomiceEvent = getattr(events, event_type)(data) event: PomiceEvent = getattr(events, event_type)(data)
if isinstance(event, TrackEndEvent):
self._current = None
event.dispatch(self._bot) event.dispatch(self._bot)
if isinstance(event, TrackStartEvent): if isinstance(event, TrackStartEvent):