Skip to content

BoQsc/How-to-Make-a-bot-using-Revolt.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Make-a-bot-in-Revolt.js

A step by step journey to make a Revolt Bot.

image

  1. Download Node JS Binary

  2. Reinstall NPM to avoid bug where .\node_modules\npm folder being deleted after first use. More information
    npm install -D npm

  3. Install revolt.js

    • npm i revolt.js
  4. Go to Revolt and open My Bots
    image

  5. Add Bot

  6. Copy Token

  7. 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("..");
  1. Insert your Token into client.loginBot("..");

  2. Start your bot with node --experimental-specifier-resolution=node bot.js

  3. Invite the bot into your server using Copy Invite Link button from My Bots Tab.
    image


  1. Edit the bot in the My Bots:
    Change profile picture and Description.
    image

Advanced

  1. 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

  2. Rehosting onto Linux Platform.
    image

    1. apt install nodejs npm -y
    2. Install revolt.js
      • npm i revolt.js
    3. node --experimental-specifier-resolution=node bot.js
  3. Make the bot stay after disconnecting from Linux Machine:

    nohup node --experimental-specifier-resolution=node bot.js > /dev/null 2>&1 & echo $! > run.pid
    
  4. Stop the bot if needed.

    kill -9 `cat run.pid`
    

Useful Linux Commands:

ps
killall node

General Information

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 $\color{red}\textsf{Red Text}$

Revolt revolt.js API Reference https://revolt.js.org/index.html