Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.97 KB

README.md

File metadata and controls

61 lines (44 loc) · 1.97 KB

NOTE: This eris' version has some modifications, our team do not recommend using it, if you want, use with your own risk.

Eris NPM version

A Node.js wrapper for interfacing with Discord.

Installing

You will need NodeJS 14.0+. If you need voice support you will also need Python 2.7 and a C++ compiler. Refer to the Getting Started section of the docs for more details.

npm install --no-optional eris

If you need voice support, remove the --no-optional.

Ping Pong Example

const { Client } = require('eris');
const client = new Client('Bot TOKEN');
// Replace TOKEN with your bot account's token

client.on('ready', () => { // When the bot is ready
  console.log('Ready!'); // Log "Ready!"
});

client.on('error', (err) => {
  console.error(err); // or your preferred logger
});

client.on('messageCreate', (msg) => { // When a message is created
  if (msg.content === '!ping') { // If the message content is "!ping"
    msg.channel.createMessage('Pong!');
      // Send a message in the same channel with "Pong!"
  } else if (msg.content === '!pong') { // Otherwise, if the message is "!pong"
    msg.channel.createMessage('Ping!');
    // Respond with "Ping!"
  }
});

client.connect(); // Get the bot to connect to Discord

More examples can be found in the examples folder.

Useful Links

License

Refer to the LICENSE file.