3.0
This commit is contained in:
parent
ffeef2df90
commit
2a62ebc2f6
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "subsonics-discord",
|
||||
"author": "Raphix",
|
||||
"version": "2.0.0",
|
||||
"version": "3.0",
|
||||
"dependencies": {
|
||||
"discord.js": "^14.9.0",
|
||||
"erela.js": "^2.4.0",
|
||||
|
90
src/commands/back.js
Normal file
90
src/commands/back.js
Normal file
@ -0,0 +1,90 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("back")
|
||||
.setDescription("Permet de revenir à la musique précédente !"),
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
let embed = new EmbedBuilder()
|
||||
.setColor(0xe033ff)
|
||||
.setTitle('Liste de lecture')
|
||||
.setDescription("Les musiques vont défiler dans cet ordre !")
|
||||
.setTimestamp();
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
|
||||
|
||||
if(!player) {
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Erreur : Back')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Aucune chanson n'a été joué précédemment !", value: "Changement impossible !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
console.log("------------------------QUEUE.JS---------------------")
|
||||
console.log(client.manager.players.get(interaction.guild.id).queue)
|
||||
let queue = client.manager.players.get(interaction.guild.id).queue;
|
||||
|
||||
|
||||
if(queue.previous == null){
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Erreur : Back')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Aucune chanson n'a été joué précédemment !", value: "Changement impossible !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0x03ff2d)
|
||||
.setTitle('Retour vers le passé !!!')
|
||||
.setDescription("**Ok, On est reparti avec "+ player.queue.previous.title +" et c'est demandée par " + interaction.member.user.username + "**")
|
||||
.setTimestamp();
|
||||
|
||||
player.stop()
|
||||
player.play(queue.previous)
|
||||
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
58
src/commands/dictator.js
Normal file
58
src/commands/dictator.js
Normal file
@ -0,0 +1,58 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("dictator")
|
||||
.setDescription("Active ou désactive le mode dictateur !"),
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
console.log(interaction.member._roles)
|
||||
|
||||
if(interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119") {
|
||||
if(client.dictator == true) {
|
||||
client.dictator = false;
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x3b3b3b)
|
||||
.setTitle('Mode Dictateur Inactif !')
|
||||
.setDescription("Le pouvoir du peuple est restauré !")
|
||||
.setTimestamp();
|
||||
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xfff200)
|
||||
.setTitle('Mode Dictateur Actif!')
|
||||
.setDescription("Notre bon roi a désormais le seul droit sur la musique !")
|
||||
.setTimestamp();
|
||||
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
client.dictator = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Erreur : Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Tu n'as pas la permission de faire cela !", value: "Verbotten !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -18,7 +18,10 @@ module.exports = {
|
||||
{name: "/leave", value: "Si tu ne veux plus du meilleur groupe du monde (faire partir le bot), cette commande les fera partir aussi vite qu'ils sont arrivés !"},
|
||||
{name: "/pause", value: "Besoin d'un entracte ? Cette commande te permettera de mettre le morceau en cours, en pause !"},
|
||||
{name: "/resume", value: "Fin de l'entracte ? Cette commande te permettera de mettre le morceau qui était en pause, en cours !"},
|
||||
{name: "/queue <afficher/supprimer>", value: "Permet d'afficher ou de supprimer les titres de la liste de lecture."})
|
||||
{name: "/queue <afficher/supprimer>", value: "Permet d'afficher ou de supprimer les titres de la liste de lecture."},
|
||||
{name: "/state", value: "Donne l'état de la musique"},
|
||||
{name: "/skip", value: "Passer à la chanson suivante."},
|
||||
{name: "/back", value: "Revenir à la chanson précédente."})
|
||||
.setTimestamp()
|
||||
.setThumbnail("https://static.wikia.nocookie.net/codelyoko/images/9/95/Subdigitals.jpg/revision/latest/scale-to-width-down/180?cb=20120105180510&path-prefix=fr");
|
||||
|
||||
|
@ -9,6 +9,30 @@ module.exports = {
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
@ -32,7 +56,7 @@ module.exports = {
|
||||
|
||||
interaction.reply("**Aucune musique n'est actuellement jouée !**")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,30 @@ module.exports = {
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
@ -35,6 +59,6 @@ module.exports = {
|
||||
|
||||
interaction.reply("**Aucune musique n'est actuellement jouée !**")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,30 @@ module.exports = {
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
const song_name = interaction.options.getString("nom_ou_lien")
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
@ -82,6 +106,6 @@ module.exports = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,30 @@ module.exports = {
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
|
||||
|
||||
@ -113,7 +137,7 @@ module.exports = {
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0xe033ff)
|
||||
.setTitle('Supressipn : Liste de lecture')
|
||||
.setTitle('Supression : Liste de lecture')
|
||||
.setDescription("La musique a été retiré de la liste de lecture !")
|
||||
.setTimestamp();
|
||||
|
||||
@ -155,6 +179,6 @@ module.exports = {
|
||||
|
||||
await interaction.reply("**La commande a été mal éxécutée !**")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,30 @@ module.exports = {
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
@ -36,6 +60,6 @@ module.exports = {
|
||||
|
||||
interaction.reply("**Aucune musique n'est actuellement jouée !**")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
89
src/commands/skip.js
Normal file
89
src/commands/skip.js
Normal file
@ -0,0 +1,89 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("skip")
|
||||
.setDescription("Permet de passer à la musique suivante !"),
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(client.dictator == true ) {
|
||||
|
||||
if((interaction.member._roles.includes("397725956598530050") == true | interaction.member.user.id == "486943594893017119")) {
|
||||
|
||||
makeAction()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Mode Dictateur')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Le mode dictateur est actif !", value: "Demande au grand roi !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
makeAction();
|
||||
}
|
||||
|
||||
async function makeAction() {
|
||||
|
||||
let embed = new EmbedBuilder()
|
||||
.setColor(0xe033ff)
|
||||
.setTitle('Liste de lecture')
|
||||
.setDescription("Les musiques vont défiler dans cet ordre !")
|
||||
.setTimestamp();
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
|
||||
|
||||
if(!player) {
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Erreur : Skip')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Aucune chanson n'est dans la queue", value: "Changement impossible !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
console.log("------------------------QUEUE.JS---------------------")
|
||||
console.log(client.manager.players.get(interaction.guild.id).queue)
|
||||
let queue = client.manager.players.get(interaction.guild.id).queue;
|
||||
|
||||
|
||||
if(queue.length == 0){
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0xff0303)
|
||||
.setTitle('Erreur : Skip')
|
||||
.setTimestamp();
|
||||
const song_show = {name: "Aucune chanson n'est dans la queue", value: "Changement impossible !"}
|
||||
|
||||
embed.addFields(song_show)
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
player.stop()
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0x03ff2d)
|
||||
.setTitle('On change de morceau !!!')
|
||||
.setDescription("**Ok, On est reparti avec "+ player.queue[0].title +" et c'est demandée par " + interaction.member.user.username + "**")
|
||||
.setTimestamp();
|
||||
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
50
src/commands/state.js
Normal file
50
src/commands/state.js
Normal file
@ -0,0 +1,50 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("state")
|
||||
.setDescription("Affiche l'état du lecteur !"),
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
if(!interaction.member.voice.channel) return interaction.reply({content:"Vous devez rejoindre un salon vocal !", ephemeral: true})
|
||||
|
||||
let player = client.manager.players.get(interaction.guild.id)
|
||||
|
||||
if(player) {
|
||||
|
||||
const date = new Date(player.queue.current.duration)
|
||||
|
||||
var gMinute = date.getMinutes()
|
||||
var gSecondes = date.getSeconds()
|
||||
|
||||
|
||||
if(date.getMinutes() <= 9) {
|
||||
gMinute = "0" + date.getMinutes()
|
||||
}
|
||||
|
||||
if(date.getSeconds() <= 9) {
|
||||
gSecondes = "0" + date.getSeconds()
|
||||
}
|
||||
|
||||
|
||||
|
||||
let embed = new EmbedBuilder()
|
||||
.setColor(0x32a875)
|
||||
.setTitle('Information sur la musique !')
|
||||
.addFields({name:"Titre", value: player.queue.current.title},
|
||||
{name:"Auteur", value: player.queue.current.author},
|
||||
{name:"URL", value: player.queue.current.uri},
|
||||
{name:"Temps", value: gMinute + ":" + gSecondes})
|
||||
.setTimestamp();
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
} else {
|
||||
|
||||
interaction.reply("**Aucune musique n'est actuellement jouée !**")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
27
src/commands/version.js
Normal file
27
src/commands/version.js
Normal file
@ -0,0 +1,27 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const packageJson = require('../../package.json');
|
||||
|
||||
module.exports = {
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("version")
|
||||
.setDescription("Affiche le ping du bot !"),
|
||||
|
||||
async execute(client, interaction) {
|
||||
|
||||
|
||||
const uptime = process.uptime();
|
||||
const minutes = Math.floor(uptime / 60);
|
||||
const seconds = Math.floor(uptime % 60);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xb0f542)
|
||||
.setTitle('Les Subsonics')
|
||||
.addFields({name: "Version ", value: packageJson.version},{name:"Uptime", value: minutes + " minutes et " + seconds + " secondes"})
|
||||
.setTimestamp();
|
||||
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"token":"MTA5NDcyNzc4OTY4MjM4MDkyMg.G4LcLR.qMZsDn_iR0rrVyie7yXxfmltn3Z_CaQIXMxUiU",
|
||||
"token":"MTA5NDcyNzc4OTY4MjM4MDkyMg.GaWsMy.zp3wY6mSOwVhHfV0k43fXdgspi24qgW7LyCD6U",
|
||||
"clientID":"1094727789682380922",
|
||||
"guildID":"137291455336022018"
|
||||
}
|
13
src/main.js
13
src/main.js
@ -1,3 +1,5 @@
|
||||
let tryTime = 0;
|
||||
|
||||
function startApp() {
|
||||
|
||||
const { Client, GatewayIntentBits, Collection } = require("discord.js")
|
||||
@ -12,7 +14,7 @@ const client = new Client({
|
||||
})
|
||||
|
||||
client.commands = new Collection()
|
||||
client.queue = []
|
||||
client.dictator = false;
|
||||
|
||||
const commands = [];
|
||||
// Grab all the command files from the commands directory you created earlier
|
||||
@ -130,11 +132,20 @@ client.on("raw", d => client.manager.updateVoiceState(d));
|
||||
|
||||
client.login(config.token)
|
||||
|
||||
tryTime = 0
|
||||
|
||||
}
|
||||
|
||||
function handleFatalError(error) {
|
||||
console.error('Erreur fatale :', error);
|
||||
console.log('Redémarrage en cours...');
|
||||
|
||||
if(tryTime == 10) {
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
tryTime += 1;
|
||||
startApp();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user