Git Product home page Git Product logo

how-to-make-a-bot-using-revolt.js's Introduction

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

how-to-make-a-bot-using-revolt.js's People

Contributors

boqsc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.