GithubHelp home page GithubHelp logo

3ventic / botranktir Goto Github PK

View Code? Open in Web Editor NEW

This project forked from truckersmp/botranktir

0.0 2.0 0.0 151 KB

Discord bot that manages roles after reacting to a message

Home Page: https://discord.gg/truckersmp

License: MIT License

JavaScript 100.00%

botranktir's Introduction

Botranktir

Description

Botranktir is a Discord bot that assign or unassign roles after reacting or removing the reaction on a message.
The bot is available for everybody to use.

Data are cached and accessing the database is done only on adding a new reaction role, removing an existing reaction role or when the bot is loaded. This provides a huge advantage of a very low amount of queries to the database and thus, the bot reacts much faster.

User Usage

Add Reaction Role

Parameters

  • channel - a mentioned channel (#channel-name)
  • message - the ID of a message where the reaction should be placed on
  • emoji - the ID of an emoji, a unicode emoji or a used emoji (e.g. :truckersmp:)
  • role - the name of a role or a mentioned role

Examples

  • [p]addrole #welcome 580458877531979786 :truckersmp: Subscriber

External emotes can be used, too. However, before using the command, react with the external emoji as first.

Delete Reaction Role

Parameters

  • channel - a mentioned channel (#channel-name)
  • message - the ID of a message where the reaction is placed on
  • emoji - the ID of an emoji, a unicode emoji or a used emoji (e.g. :truckersmp:) that was used for managing the role

Examples

  • [p]delrole #welcome 580458877531979786 :truckersmp:

Fetching Reaction Roles for a Message

Parameters

  • channel - a mentioned channel (#channel-name)
  • message - the ID of a message about which the information should be get

Examples

  • [p]fetchmessage #welcome 580458877531979786

Requirements

  • npm
  • Node 10.14.x or newer

Installation

  1. Download the repository.
  2. Run the npm install command in the root folder.
    Due to the usage of Knex, we recommend installing it globally: npm install knex -g
  3. Copy the sample config file (config/config.sample.json) and create your own config file (config/config.json).
  4. Create a new database.
  5. Set up the config properties.
  6. Run all migrations (knex migrate:latest).
  7. Invite the bot to the guild with necessary permissions: Manage Roles, Read Message History and Embed Links.
    The bot additionally needs permissions Read Messages and Send Messages in the channel which is used for its configuration. On top of that, Read Messages and Add Reactions are permissions which are necessary in the channel with reaction roles.

    Hint: If you are new to Discord, it is safe to give the bot the Administrator permission.

  8. Move bot's role over all roles that are supposed to be granted by reacting to a message.
  9. Start the bot by running the command npm run prod.

Running

The bot is using PM2 and thus, it can be run under two different environments:

  • Production: npm run prod (pm2 start pm2.json)
  • Development: npm run dev (pm2-dev start pm2.json --env=development)

Configuration

  • bot.token - can be obtained on the Discord Developer Portal after creating an application and setting it up as a bot.
  • bot.prefix - a prefix for all commands.
    Make sure it does not conflict with your other bots on the server due to a usage of default commands.
  • bot.owner - an array of owners. You can change the ID to your own so you can manage the bot.
  • bot.messageCache - the amount of messages per channel that will be cached.
  • defaultCommands - managing default commands.
    Non-mentioned commands are enabled by default.

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.