Réécriture complète 4.0
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
This commit is contained in:
22
src/buttons/player/loop.ts
Normal file
22
src/buttons/player/loop.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { MessageFlags } from "discord.js"
|
||||
import type { ButtonInteraction } from "discord.js"
|
||||
import { useQueue } from "discord-player"
|
||||
import { t } from "@/utils/i18n"
|
||||
|
||||
export const id = "player_loop"
|
||||
export async function execute(interaction: ButtonInteraction) {
|
||||
const queue = useQueue(interaction.guild?.id ?? "")
|
||||
if (!queue) return
|
||||
|
||||
const loop = queue.repeatMode === 0 ? 1 : queue.repeatMode === 1 ? 2 : queue.repeatMode === 2 ? 3 : 0
|
||||
queue.setRepeatMode(loop)
|
||||
|
||||
const loopModes = {
|
||||
0: t(interaction.locale, "player.loop_off"),
|
||||
1: t(interaction.locale, "player.loop_track"),
|
||||
2: t(interaction.locale, "player.loop_queue"),
|
||||
3: t(interaction.locale, "player.loop_autoplay")
|
||||
}
|
||||
|
||||
return interaction.followUp({ content: loopModes[loop], flags: MessageFlags.Ephemeral })
|
||||
}
|
||||
Reference in New Issue
Block a user