This is a very minimal discord bot that allows you to associate invites with specific roles so that when that invite is used, the role is automatically added.
git clone https://github.com/okwme/discord-invite-role-bot
cd discord-invite-role-bot
npm i
There's a file called config.json.example
. Rename it config.json
and add your discord Bot Token. To learn how to do this follow these instructions.
cp config.json.example config.json
You may want to delete the contents of invites.json
which is used to store the invite codes. It is currently filled with invite codes for the Cosmos Network discord.
echo "{}" > invites.json
This is a single file node.js app so it can be run like:
node index.js
You may want to use pm2 to run it on a server so it records logs and will restart if it crashes:
pm2 start discord-invite-role-bot
pm2 save
Make sure the bot is:
- added to your server
- has admin permissions
- in the list of roles the bot shows up above any roles it will be managing
To list all links
~list
To add a new role use:
~add https://discord.gg/abcdegh @role-name
To remove a role:
// NOT IMPLEMENTED
~remove https://discord.gg/abcdefgh