add pause/resume command
This commit is contained in:
parent
fee7af21d2
commit
91c6e5fe37
2 changed files with 53 additions and 4 deletions
44
src/commands/music/pause.ts
Normal file
44
src/commands/music/pause.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { ChatInputCommandInteraction, Client } from "discord.js";
|
||||
import { getLocale, getLocalizations } from "../../utils/locales";
|
||||
import { getFilename } from "../../utils/misc";
|
||||
|
||||
export default {
|
||||
scope: () => [],
|
||||
|
||||
data: (client: Client) => {
|
||||
const filename = getFilename(__filename);
|
||||
const loc_default = client.locales.get(client.config.default_lang);
|
||||
if (!loc_default) {
|
||||
return;
|
||||
}
|
||||
|
||||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
},
|
||||
|
||||
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
const queue = client.player.queues.get(interaction.guildId ?? "");
|
||||
|
||||
if (queue) {
|
||||
if (queue.paused) {
|
||||
queue.resume();
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.reply(loc.get("c_pause1"));
|
||||
} else {
|
||||
queue.pause();
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.reply(loc.get("c_pause2"));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.reply(loc.get("c_pause3"));
|
||||
},
|
||||
};
|
|
@ -87,10 +87,15 @@
|
|||
"c_play3": "Impossible de rejoindre le salon vocal.",
|
||||
"c_play4": "introuvable",
|
||||
"c_play5": "ajouté à la file d'attente",
|
||||
"c_play_6": "Le bot ne joue rien en ce moment.",
|
||||
"c_play_7": "Joue actuellement",
|
||||
"c_play6": "Le bot ne joue rien en ce moment.",
|
||||
"c_play7": "Joue actuellement",
|
||||
"c_stop_name": "stop",
|
||||
"c_stop_desc": "Stop la musique",
|
||||
"c_stop1": "Le bot ne joue pas de musique.",
|
||||
"c_stop2": "La musique à été arrêtée."
|
||||
"c_stop1": "Le bot ne joue rien en ce moment.",
|
||||
"c_stop2": "La musique à été arrêtée.",
|
||||
"c_pause_name": "pause",
|
||||
"c_pause_desc": "Met en pause ou relance la musique",
|
||||
"c_pause1": "Relance la musique...",
|
||||
"c_pause2": "Met en pause la musique.",
|
||||
"c_pause3": "Le bot ne joue rien en ce moment."
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue