Last active
April 2, 2018 07:45
-
-
Save tt024/4d1ea1564423ec2b66dc0343caa0a755 to your computer and use it in GitHub Desktop.
Explication des différentes lignes de codes // https://medium.com/@thxo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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