Version 0.1.0 - Mise en place de Discord.js
This commit is contained in:
36
backend/src/discord/Commands/About.js
Normal file
36
backend/src/discord/Commands/About.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const { Command } = require('../Command');
|
||||
const { Embed } = require('../Embed');
|
||||
const { __glob } = require("../../utils/GlobalVars");
|
||||
const packageJson = require(__glob.PACKAGEINFO);
|
||||
|
||||
const command = new Command("about", "Affiche des informations sur le bot", (client, interaction) => {
|
||||
|
||||
const uptime = process.uptime();
|
||||
const hours = Math.floor(uptime / 3600);
|
||||
const minutes = Math.floor((uptime % 3600) / 60);
|
||||
const seconds = Math.floor(uptime % 60);
|
||||
|
||||
const embed = new Embed()
|
||||
embed.setColor(0xb0f542)
|
||||
embed.setThumbnail("https://cdn.discordapp.com/avatars/" + client.user.id + "/" + client.user.avatar + ".png")
|
||||
embed.setTitle('Subsonics - Chopin')
|
||||
embed.addField('Informations',"")
|
||||
embed.addField('Version', packageJson.version + " ", true)
|
||||
embed.addField('Uptime', `${hours}h ${minutes}m ${seconds}s `, true)
|
||||
embed.addField("Ping", `${client.ws.ping} ms `, true)
|
||||
embed.addField("Réalisé par", "Raphix - 2025", true)
|
||||
embed.addColumn()
|
||||
embed.addField('Versions',"")
|
||||
embed.addField('Node.js', process.version,true)
|
||||
embed.addField('Discord.js', packageJson.dependencies["discord.js"].replace("^", ""),true)
|
||||
embed.addColumn()
|
||||
embed.addField('Webmetrik', packageJson.dependencies["webmetrik"].replace("^", ""),true)
|
||||
embed.addField('Loguix', packageJson.dependencies["loguix"].replace("^", ""),true)
|
||||
embed.addColumn()
|
||||
|
||||
embed.send(interaction)
|
||||
|
||||
|
||||
})
|
||||
|
||||
module.exports = {command}
|
34
backend/src/discord/Commands/Help.js
Normal file
34
backend/src/discord/Commands/Help.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const { Command } = require('../Command');
|
||||
const { Embed } = require('../Embed');
|
||||
|
||||
const command = new Command("help", "Affiche la liste des commandes", (client, interaction) => {
|
||||
|
||||
const embed = new Embed()
|
||||
embed.setColor(0x03ff2d)
|
||||
embed.setTitle('Comment assister au concert ?')
|
||||
embed.setDescription("**Eh ! Tu as eu ton ticket ? Tant mieux ! Voici la liste des commandes à utiliser dans le salon prévu à cet effet !**")
|
||||
embed.addField('**Liste des commandes :**',"")
|
||||
client.commands.forEach(command => {
|
||||
let CommandName = command.data.name
|
||||
|
||||
if (command.data.options) {
|
||||
command.data.options.forEach(option => {
|
||||
if (option.choices) {
|
||||
let choices = []
|
||||
option.choices.forEach(choice => {
|
||||
choices.push(choice.name)
|
||||
})
|
||||
CommandName += " " + choices.join(" | ")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
embed.addField("/" + CommandName, command.data.description)
|
||||
|
||||
})
|
||||
embed.addField("La queue et la gestion du redémarrage se fait par le site https://subsonics.raphix.fr/", ":star:" )
|
||||
embed.setThumbnail("https://static.wikia.nocookie.net/codelyoko/images/9/95/Subdigitals.jpg/revision/latest/scale-to-width-down/180?cb=20120105180510&path-prefix=fr");
|
||||
embed.send(interaction)
|
||||
})
|
||||
|
||||
module.exports = {command}
|
36
backend/src/discord/Commands/Report.js
Normal file
36
backend/src/discord/Commands/Report.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const { Command } = require('../Command');
|
||||
const { Embed } = require('../Embed');
|
||||
const { Report } = require('../ReportSender');
|
||||
|
||||
const command = new Command("report", "Signaler un problème avec le bot", (client, interaction) => {
|
||||
const report = new Report(interaction.user.username, interaction.options.getString("type"), interaction.options.getString("description"))
|
||||
const result = report.send()
|
||||
const embed = new Embed()
|
||||
|
||||
|
||||
result.then((res) => {
|
||||
if(!res) {
|
||||
embed.setColor(0xc20f02)
|
||||
embed.setTitle('Erreur')
|
||||
embed.setDescription("Une erreur est survenue lors de l'envoi du rapport")
|
||||
|
||||
} else {
|
||||
embed.setColor(0x00ff66)
|
||||
embed.setTitle('Rapport envoyé')
|
||||
embed.setDescription("Votre rapport a bien été envoyé !")
|
||||
|
||||
}
|
||||
embed.send(interaction)
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
[{type: "CHOICES", name: "type", description: "Type", required: true, choices:
|
||||
[{name: "Bug", value: "bug"},
|
||||
{name: "Suggestion", value: "sugguestion"}],
|
||||
},
|
||||
{type: "STRING", name: "description", description: "Description du problème", required: true}]
|
||||
|
||||
)
|
||||
|
||||
module.exports = {command}
|
14
backend/src/discord/Commands/Web.js
Normal file
14
backend/src/discord/Commands/Web.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { Command } = require('../Command');
|
||||
const { Embed } = require('../Embed');
|
||||
|
||||
const command = new Command("web", "Affiche le lien vers le site web pour contrôler le bot", (client, interaction) => {
|
||||
const embed = new Embed()
|
||||
embed.setColor(0xffffff)
|
||||
embed.setTitle('Subsonics - Chopin')
|
||||
embed.addBotPicture(client)
|
||||
embed.addField('Lien',"https://subsonics.raphix.fr/")
|
||||
embed.send(interaction)
|
||||
|
||||
})
|
||||
|
||||
module.exports = {command}
|
Reference in New Issue
Block a user