Cynosphere / dysnomia

A fork of Eris, a Discord Node.js library, focused on keeping up with the latest Discord API changes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Dysnomia

A fork of Eris, a Node.js wrapper for interfacing with Discord, focused on keeping up with the latest Discord API changes.

Installing

You will need NodeJS 10.4+. Voice support requires additional software.

npm install --no-optional @projectdysnomia/dysnomia

If you'd like to install the development versions of the library, use the following command instead:

npm install --no-optional github:projectdysnomia/dysnomia#dev

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

Ping Pong Example

const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Dysnomia("Bot TOKEN", {
    gateway: {
        intents: [
            "guildMessages"
        ]
    }
});

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

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

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

License

Refer to the LICENSE file.

About

A fork of Eris, a Discord Node.js library, focused on keeping up with the latest Discord API changes.

License:MIT License


Languages

Language:JavaScript 100.0%