mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
22 lines
581 B
Python
22 lines
581 B
Python
import typing
|
|
from lavalink import DefaultPlayer
|
|
|
|
if typing.TYPE_CHECKING:
|
|
from lavalink import Node
|
|
from lavalink.models import AudioTrack
|
|
|
|
|
|
class CustomPlayer(DefaultPlayer):
|
|
def __init__(self, guild_id: int, node: "Node"):
|
|
from bot import config
|
|
|
|
self.history: typing.List["AudioTrack"] = []
|
|
self.max_size = config["history_size"]
|
|
|
|
super().__init__(guild_id, node)
|
|
|
|
def append_history(self, track: "AudioTrack"):
|
|
self.history.insert(0, track)
|
|
if len(self.history) > self.max_size:
|
|
self.history.pop(-1)
|