A step by step journey to make a Revolt Bot.
-
Download Node JS Binary
-
Reinstall NPM to avoid bug where .\node_modules\npm folder being deleted after first use. More information
npm install -D npm
-
Install revolt.js
npm i revolt.js
-
Add Bot
-
Copy Token
-
Use CommonJS example.
bot.js
// This is a bot.js example.
const { Client } = require("revolt.js");
let client = new Client();
client.on("ready", async () => {
console.info(`User ID: ${client.user._id}!`);
console.info(`Logged in as ${client.user.username}!`);
console.info(`Bot online: ${client.user.online}!`);
client.users.edit({
status: {
text: "Listening to you.",
presence: "Idle",
},
});
console.info(`Logged in as ${client.user.bot.status}!`);
});
client.on("message", async (message) => {
if (message.content === "hello") {
message.channel.sendMessage("world");
}
});
client.loginBot("..");
-
Insert your Token into
client.loginBot("..");
-
Start your bot with
node --experimental-specifier-resolution=node bot.js
-
Invite the bot into your server using Copy Invite Link button from My Bots Tab.
-
Enabling TypeScript
This part of article is incomplete and needs help.
npm i -D typescript
npm i revolt-api
npm i -D @types/node
npm i -D @types/ws
npm i axios
npm i -D @insertish/oapi
npx tsc bot.ts --lib ES6 --lib DOM --esModuleInterop --module ES6
npx tsc --showConfig
npx tsc bot.ts --lib ES6 --lib DOM --esModuleInterop --module ES6 --moduleResolution node --target ES6 --showConfig
npx tsc bot.ts --esModuleInterop --module ES6 --moduleResolution node --target ES6 --experimentalDecorators --strict --showConfig
https://github.com/debertjamie/revolt-bot-template/blob/master/tsconfig.json
Current issue: revoltchat/revolt.js#57 -
Rehosting onto Linux Platform.
apt install nodejs npm -y
- Install revolt.js
npm i revolt.js
node --experimental-specifier-resolution=node bot.js
-
Make the bot stay after disconnecting from Linux Machine:
nohup node --experimental-specifier-resolution=node bot.js > /dev/null 2>&1 & echo $! > run.pid
-
Stop the bot if needed.
kill -9 `cat run.pid`
Useful Linux Commands:
ps
killall node
Revolt Web Client Production Source Code Repository https://github.com/revoltchat/revite/tree/production
Revolt Windows Client releases https://github.com/revoltchat/desktop/releases
Revolt API Changes https://developers.revolt.chat/changes/
Revolt Experimental Plugin API https://developers.revolt.chat/plugin-api
Revolt Markdown Reference https://developers.revolt.chat/markdown
Revolt Architecture Map https://developers.revolt.chat/stack/
Revolt Bot programming Introduction https://developers.revolt.chat/stack/revolt.js/guide/discord_js_migration
Revolt Bot programming basics https://github.com/revoltchat/revolt.js
Revolt Katex Example
https://developers.revolt.chat/markdown#katex
Revolt revolt.js API Reference https://revolt.js.org/index.html