eris

A NodeJS Discord library

Eris

A NodeJS wrapper for interfacing with Discord.

Installing

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

npm install --no-optional eris

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

Ping Pong Example

const Eris = require("eris");

var bot = new Eris("BOT_TOKEN");
// Replace BOT_TOKEN with your bot account's token

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

bot.on("messageCreate", (msg) => { // When a message is created
    if(msg.content === "!ping") { // If the message content is "!ping"
        bot.createMessage(msg.channel.id, "Pong!");
        // Send a message in the same channel with "Pong!"
    } else if(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 Discord

More examples can be found in the examples folder.

Useful Links

The websiteincludes more detailed information on getting started, as well as documentation for the different components.

The Discord API channel (#js_eris)is the best place to get support/contact me.

The GitHub repohas the most updated code.

The NPM package

License

Refer to the LICENSEfile.

HomePage

https://abal.moe/Eris/

Repository

https+https://github.com/abalabahaha/eris


上一篇:opusscript
下一篇:Vue中this.$nextTick 的作用

相关推荐

  • gibberish-aes

    A lightweight Javascript Libray for OpenSSL compatible AES CBC encryption. gibberishaes...

    2 年前
  • cipherise-sdk

    A service provider SDK for Forticode Cipherise. Cipherise TypeScript SDK Version 6.3.1 This SDK ...

    3 个月前
  • angular 2 why asterisk (*)

    Michael LaffargueMaxLXJ(https://stackoverflow.com/users/602928/michaellaffargue)提出了一个问题:angular 2 wh...

    2 年前
  • What's the purpose of an asterisk (*) in ES6 generator functions

    alexpods(https://stackoverflow.com/users/2511783/alexpods)提出了一个问题:What's the purpose of an asterisk ...

    2 年前
  • ES6 class characteristics

    概述 class (类)作为对象的模板被引入,可以通过 class 关键字定义类。类简要说明(https://www.runoob.com/w3cnote/es6class.html) 类的本质是...

    10 个月前
  • @saeris/graphql-scalars

    A collection of scalar types using Joi for validation. GraphQL Scalars ...

    5 个月前
  • @aerisweather/deploy-lambda-function

    Script for deploying code as a lambda function @aerisweather/deploylambdafunction Helper for depl...

    3 个月前

官方社区

扫码加入 JavaScript 社区