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 iThere's a file called .env.example. Copy it to .env and add your discord Bot Token and Guild ID. To learn how to do this follow these instructions.
cp .env.example .envYou 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.jsonThis is a single file node.js app so it can be run like:
node index.jsYou 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 saveMake 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
~listTo add a new role use:
~add https://discord.gg/abcdegh @role-nameTo remove a role:
// NOT IMPLEMENTED
~remove https://discord.gg/abcdefgh