Added forward and rewind button
This commit is contained in:
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "取消靜音",
|
||||
"buttonAutoPlay": "自動播放",
|
||||
"buttonShuffle": "隨機播放",
|
||||
"buttonForward": "前進",
|
||||
"buttonRewind": "後退",
|
||||
|
||||
"nowplayingDesc": "**現在播放:**\n```{0}```",
|
||||
"nowplayingField": "接下來播放:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "Stummschaltung aufheben",
|
||||
"buttonAutoPlay": "Autoplay",
|
||||
"buttonShuffle": "Mischen",
|
||||
"buttonForward": "Vorwärts",
|
||||
"buttonRewind": "Rückwärts",
|
||||
|
||||
"nowplayingDesc": "**Jetzt abspielen:**\n```{0}```",
|
||||
"nowplayingField": "Als nächstes:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "Unmute",
|
||||
"buttonAutoPlay": "Autoplay",
|
||||
"buttonShuffle": "Shuffle",
|
||||
"buttonForward": "Forward",
|
||||
"buttonRewind": "Rewind",
|
||||
|
||||
"nowplayingDesc": "**Now Playing:**\n```{0}```",
|
||||
"nowplayingField": "Up Next:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "Activar Sonido",
|
||||
"buttonAutoPlay": "Reproducción Automática",
|
||||
"buttonShuffle": "Aleatorio",
|
||||
"buttonForward": "Adelante",
|
||||
"buttonRewind": "Atrás",
|
||||
|
||||
"nowplayingDesc": "**Reproduciendo ahora:**\n```{0}```",
|
||||
"nowplayingField": "A continuación:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "消音を解除",
|
||||
"buttonAutoPlay": "自動再生",
|
||||
"buttonShuffle": "シャッフル",
|
||||
"buttonForward": "進む",
|
||||
"buttonRewind": "戻る",
|
||||
|
||||
"nowplayingDesc": "**現在再生中:**\n```{0}```",
|
||||
"nowplayingField": "次に再生する曲:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
"buttonVolumeUnmute": "음소거 해제",
|
||||
"buttonAutoPlay": "자동재생",
|
||||
"buttonShuffle": "셔플",
|
||||
"buttonForward": "앞으로",
|
||||
"buttonRewind": "뒤로",
|
||||
|
||||
"nowplayingDesc": "**현재 재생중인 곡:**\n```{0}```",
|
||||
"nowplayingField": "다음 곡:",
|
||||
|
||||
@@ -31,6 +31,7 @@ from function import (
|
||||
update_playlist,
|
||||
create_account,
|
||||
checkroles,
|
||||
formatTime
|
||||
)
|
||||
from typing import Dict
|
||||
|
||||
@@ -282,6 +283,44 @@ class Shuffle(discord.ui.Button):
|
||||
await self.player.shuffle("queue", interaction.user)
|
||||
await interaction.response.send_message(self.player.get_msg('shuffled'))
|
||||
|
||||
class Forward(discord.ui.Button):
|
||||
def __init__(self, player, style, row):
|
||||
self.player = player
|
||||
super().__init__(emoji="⏩",
|
||||
label=player.get_msg('buttonForward'),
|
||||
disabled=False if self.player.current else True,
|
||||
style=style, row=row)
|
||||
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
if not self.player.is_privileged(interaction.user):
|
||||
return await interaction.response.send_message(self.player.get_msg('missingPerms_pos'), ephemeral=True)
|
||||
|
||||
if not self.player.current:
|
||||
return await interaction.response.send_message(self.player.get_msg('noTrackPlaying'), ephemeral=True)
|
||||
|
||||
await self.player.seek(self.player.position + 10000)
|
||||
await interaction.response.send_message(self.player.get_msg('forward').format(func.time(self.player.position + 10000)))
|
||||
|
||||
class Rewind(discord.ui.Button):
|
||||
def __init__(self, player, style, row):
|
||||
self.player = player
|
||||
super().__init__(emoji="⏪",
|
||||
label=player.get_msg('buttonRewind'),
|
||||
disabled=False if self.player.current else True,
|
||||
style=style, row=row)
|
||||
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
if not self.player.is_privileged(interaction.user):
|
||||
return await interaction.response.send_message(self.player.get_msg('missingPerms_pos'), ephemeral=True)
|
||||
|
||||
if not self.player.current:
|
||||
return await interaction.response.send_message(self.player.get_msg('noTrackPlaying'), ephemeral=True)
|
||||
|
||||
position = 0 if (value := (self.player.position - 10000)) <= 0 else value
|
||||
|
||||
await self.player.seek(position)
|
||||
await interaction.response.send_message(self.player.get_msg('rewind').format(func.time(position)))
|
||||
|
||||
class Tracks(discord.ui.Select):
|
||||
def __init__(self, player, style, row):
|
||||
|
||||
@@ -320,7 +359,9 @@ btnType = {
|
||||
"volumemute": VolumeMute,
|
||||
"tracks": Tracks,
|
||||
"autoplay": AutoPlay,
|
||||
"shuffle": Shuffle
|
||||
"shuffle": Shuffle,
|
||||
"forward": Forward,
|
||||
"rewind": Rewind
|
||||
}
|
||||
|
||||
btnColor = {
|
||||
|
||||
Reference in New Issue
Block a user