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.
channel
- a mentioned channel (#channel-name
)message
- the ID of a message where the reaction should be placed onemoji
- 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
[p]addrole #welcome 580458877531979786 :truckersmp: Subscriber
External emotes can be used, too. However, before using the command, react with the external emoji as first.
channel
- a mentioned channel (#channel-name
)message
- the ID of a message where the reaction is placed onemoji
- the ID of an emoji, a unicode emoji or a used emoji (e.g.:truckersmp:
) that was used for managing the role
[p]delrole #welcome 580458877531979786 :truckersmp:
channel
- a mentioned channel (#channel-name
)message
- the ID of a message about which the information should be get
[p]fetchmessage #welcome 580458877531979786
- npm
- Node 10.14.x or newer
- Download the repository.
- Run the
npm install
command in the root folder.
Due to the usage of Knex, we recommend installing it globally:npm install knex -g
- Copy the sample config file (
config/config.sample.json
) and create your own config file (config/config.json
). - Create a new database.
- Set up the config properties.
- Run all migrations (
knex migrate:latest
). - Invite the bot to the guild with necessary permissions:
Manage Roles
,Read Message History
andEmbed Links
.
The bot additionally needs permissionsRead Messages
andSend Messages
in the channel which is used for its configuration. On top of that,Read Messages
andAdd 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. - Move bot's role over all roles that are supposed to be granted by reacting to a message.
- Start the bot by running the command
npm run prod
.
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
)
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.