Files
bot_Tamiseur/src/commands/player/previous.ts
Zachary Guénot 60d0c01212
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 5m5s
Fix chmod
2025-06-09 19:10:35 +02:00

19 lines
836 B
TypeScript

import { SlashCommandBuilder, MessageFlags } from "discord.js"
import type { ChatInputCommandInteraction } from "discord.js"
import { useHistory } from "discord-player"
import { t } from "@/utils/i18n"
export const data = new SlashCommandBuilder()
.setName("previous")
.setDescription("Play the previous song")
.setNameLocalizations({ fr: "precedent" })
.setDescriptionLocalizations({ fr: "Joue la musique précédente" })
export async function execute(interaction: ChatInputCommandInteraction) {
const history = useHistory(interaction.guild?.id ?? "")
if (!history) return interaction.reply({ content: t(interaction.locale, "player.no_session"), flags: MessageFlags.Ephemeral })
await history.previous()
return interaction.reply({ content: t(interaction.locale, "player.previous_played"), flags: MessageFlags.Ephemeral })
}