This is a NodeJS recreation of the working Revolution API.
Install our Revolution.js Node library by this command:
npm i revolution.js
// 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
// 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
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
})();
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
});
- Getting the ID of the channel of a message has been changed from
message.channel
tomessage.channel.id
- Getting the content of a message is changed from
message.message
tomessage.content
- The
servers
argument in the Bot constructor has been changed tochannels
- Instead of using
commands.Bot()
, theBot
class should be used directly
You can find the documentation at https://github.com/JustAnEric/Revolution.js/wiki/Documentation