-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.js
More file actions
26 lines (21 loc) · 1.14 KB
/
hello.js
File metadata and controls
26 lines (21 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// On importe quelques éléments
const { SlashCommandBuilder } = require('discord.js')
const bacheroFunctions = require('../../functions')
const database = bacheroFunctions.database.getDatabase('com.example.helloworld')
// Et on exporte ce qu'il faut
module.exports = {
slashInfo: new SlashCommandBuilder()
.setName('helloworld')
.setDescription('Salut tout le monde !'),
async execute(interaction){
// Vérifier et répondre si l'utilisateur est limité, sinon on le limite
var checkAndReply = await bacheroFunctions.cooldown.checkAndReply(interaction, 'helloworldUsage')
if(checkAndReply) return; else await bacheroFunctions.cooldown.set('helloworldUsage', interaction.user.id, 5000)
// Obtenir le nombre d'utilisations dans la base de données
var count = await bacheroFunctions.database.get(database, 'count') || 0
// Répondre
interaction.reply(`Hello ${bacheroFunctions.config.getValue('com.example.helloworld', 'name')} (${count} fois)`)
// Redéfinir le nombre avec +1
bacheroFunctions.database.set(database, 'count', count + 1)
}
}