A Node.js wrapper for interfacing with Discord.
You will need NodeJS 10.4+. 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.
constEris=require("eris");// Replace TOKEN with your bot account's tokenconstbot=newEris("Bot TOKEN",{intents: ["guildMessages"]});bot.on("ready",()=>{// When the bot is readyconsole.log("Ready!");// Log "Ready!"});bot.on("error",(err)=>{console.error(err);// or your preferred logger});bot.on("messageCreate",(msg)=>{// When a message is createdif(msg.content==="!ping"){// If the message content is "!ping"bot.createMessage(msg.channel.id,"Pong!");// Send a message in the same channel with "Pong!"}elseif(msg.content==="!pong"){// Otherwise, if the message is "!pong"bot.createMessage(msg.channel.id,"Ping!");// Respond with "Ping!"}});bot.connect();// Get the bot to connect to DiscordMore examples can be found in the examples folder.
- The website has more details and documentation.
- The official Eris server is the best place to get support.
- The GitHub repo is where development primarily happens.
- The NPM package webpage is, well, the webpage for the NPM package.
Refer to the LICENSE file.