mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
Added history support and changed track fmting
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user