A
A
AndreyKawilov2020-08-25 18:53:58
Node.js
AndreyKawilov, 2020-08-25 18:53:58

How to run a simple discord bot Electron Node js?

The simplest html code. It is necessary to start the Discord bot on page load.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Main Page</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:[email protected];400;500&display=swap" rel="stylesheet">
</head>

<body>
    <button id="butn" class="sendButton">Send Embed</button>
</body>

    <script src="script.js"></script>

</html>


window.addEventListener('load', function() {
    const Discord = require('discord.js');
  const client = new Discord.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('token');
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-08-25
@Alexandre888

The simplest html code. It is necessary to start the Discord bot on page load.

What's the problem? As far as I can see, the code is absolutely correct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question