1.3.1 • Published 4 months ago

revolution.js v1.3.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

Revolution.js

This is a NodeJS recreation of the working Revolution API.

Install our Revolution.js Node library by this command:

npm i revolution.js

Usage and Examples

Getting Started

Events Example

// EVENTS
  
client.listen("ready", () => {
  console.log("Hello. The bot is online!")
});
  
client.listen("server_message", async (id, raw) => {
  console.log("A message has been sent by my users!");
  if (raw.message == ".super") {
    await bot.send_message(id, raw.message); //repeat the message back to the user of the server!
  }
});
  // EVENTS END

General Example

ES6
// NESSACERY IMPORTS
import { Bot } from 'revolution.js';
// NESSACERY IMPORTS END

// BOT CLIENT  
const client = new Bot({
  token: process.env.token, // default: null; your token is here, authorizes your bot to our servers.
  channels: ["revolution~chat"]
});

await client.run()

// BOT CLIENT END
console.log(client)
// EVENTS
  
client.listen("ready", () => {
  console.log("Hello. The bot is online!")
});
  
client.listen("server_message", async (id, data) => {
  console.log("A message has been sent by my users!");
  if (data.content === ".super") {
    await data.channel.send(data.content); //repeat the message back to the user of the server!
  }
});
// EVENTS END
CommonJS
const req = (async function () {
  // NESSACERY IMPORTS
  const { Bot } = await import('revolution.js');
  // NESSACERY IMPORTS END

  // BOT CLIENT  
  const client = new Bot({
    token: process.env.token, // default: null; your token is here, authorizes your bot to our servers.
    channels: ["revolution~chat"]
  });

  await client.run()

  // BOT CLIENT END
  console.log(client)
  // EVENTS
  
  client.listen("ready", () => {
    console.log("Hello. The bot is online!")
  });
  
  client.listen("server_message", async (id, data) => {
    console.log("A message has been sent by my users!");
    if (data.content === ".super") {
      await data.channel.send(data.content); //repeat the message back to the user of the server!
    }
  });
  // EVENTS END
})();

Commands

const client = new Bot({
  token: process.env.token,
  name: 'Bot',
  channels: ["revolution~chat"],
  commands: true, // to enable commands
  prefix: "!", // the prefix you want,
  help: true // if you want a help command
});

Migrating from Older Versions

1.2 to 1.3

  • Getting the ID of the channel of a message has been changed from message.channel to message.channel.id
  • Getting the content of a message is changed from message.message to message.content
  • The servers argument in the Bot constructor has been changed to channels

1.0 to 1.2

  • Instead of using commands.Bot(), the Bot class should be used directly

Documentation

You can find the documentation at https://github.com/JustAnEric/Revolution.js/wiki/Documentation

1.3.1

4 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago