Partage
  • Partager sur Facebook
  • Partager sur Twitter

Création bot discord

    9 février 2021 à 9:30:14

    Bonjour,

    J'essaye de créer un bot discord mais pour une raison qui m'échappe, je ne peux pas lancer mon code.

    const { Client } = require('discord.js');
    const client = new Client();

    client.on('ready', () => {
      console.log(`Logged in as ${client.user.tag}!`);
    });

    client.on('message'msg => {
      if (msg.content === 'ping') {
        msg.reply('pong');
      }
    });

    client.login('ODA4MzAzNzYxNTgzMTEyMjUy.YCElig.weC3GlDRj4zEF9yzbJxUy3gxHv8');
    c'est pourtant le code exemple de la bibliothèque discord.js .....
    Voici ce que me dit la console : 
    PS C:\Users\33623\OneDrive\Bureau\discord> node .\main.js
    (node:7912) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
        at WebSocketManager.connect (C:\Users\33623\OneDrive\Bureau\discord\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26)
        at Client.login (C:\Users\33623\OneDrive\Bureau\discord\node_modules\discord.js\src\client\Client.js:223:21)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:7912) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:7912) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not 
    handled will terminate the Node.js process with a non-zero exit code.
    merci de votre aide !!
    • Partager sur Facebook
    • Partager sur Twitter

    Création bot discord

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown