Skip to content

Instantly share code, notes, and snippets.

@tt024
Last active April 2, 2018 07:45
Show Gist options
  • Save tt024/4d1ea1564423ec2b66dc0343caa0a755 to your computer and use it in GitHub Desktop.
Save tt024/4d1ea1564423ec2b66dc0343caa0a755 to your computer and use it in GitHub Desktop.
Explication des différentes lignes de codes // https://medium.com/@thxo
const Discord = require('discord.js'); // Il faut le package discord.js
const client = new Discord.Client(); // Le "client" est un nouveau client discord
client.on('ready', () => { // Quand le bot est connecté
console.log(`Logged in as ${client.user.tag}!`); // il affiche ce message dans la console
});
client.on('message', msg => { // message est défini par la variable "msg"
if (msg.content === 'ping') { // Quand un message contient "ping"
msg.reply('pong'); // le bot répond "pong" dans le salon Discord
}
});
client.login('token'); // Le token est le numéro secret pour se connecter à votre bot, ne le donnez jamais!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment