A Discord.js bot used to verify users by email.
(TO-DO: Add a demonstration)
Feel free to fork or clone this to use at your own university or organization!
Running the bot:
- Starting:
npm start
- Start the bot normally - Development:
npm run dev
- Starts and live reloads the bot as source coed changes - Tests:
npm test
- Runs all automated tests against bot
Required:
- Install Node.js (JavaScript) v16 or above
- Add an app password to your email provider (e.g. Gmail)
- Create a Discord.js bot
- Add your Discord bot to your server
Optional:
1. (Required) Open a new terminal, clone this repository and install required dependencies:
git clone https://github.com/RogueArt/ucla-cs-verify-bot.git
cd ucla-cs-verify-bot
npm install
2. (Required) Setting enviornment variables (protected data):
- Make a copy of
.env.example
and rename it to.env
- Replace all of the values below with your own
Environment Variables:
Variable | Allowed Values | Explanation |
---|---|---|
BOT_TOKEN |
Discord bot's token | See tutorial here on how to find this |
SENDER_SERVICE |
Gmail , Outlook , Yahoo , etc. |
See Nodemailer's list of well-known email addresses |
SENDER_EMAIL |
Email account you're sending the email from | Must be a valid formatted email address, e.g. [email protected] |
SENDER_PASS |
Password of the email account you're sending from | Can be account password, but see above on setting app password |
3. (Required) Set required configuration:
- Make a copy of
config.example.js
and rename it toconfig.js
- Edit the file and replace the following required values with your own. The rest can be left as-is:
Required Configuration:
Variable | Allowed Values |
---|---|
serverID |
See how to find Discord IDs |
verifiedRoleID |
See how to find Discord IDs |
adminID |
See how to find Discord IDs |
allowedEmailDomains |
Any email domain name, e.g. gmail.com , outlook.com , g.ucla.edu |
from |
Must be in format "Any Text Here" <[email protected]>" |
subject |
Can be any text, recommended to put your discord name here |
Where can I report an issue?: Feel free to raise any issues regarding anything or beyond this list:
- Bugs or program errors
- Code quality improvements
- Documentation (translations are welcome!)
- Missing or improper testing
- Internationalization (i18n) support for the bot
- Anything else!
How can I contribute? (TO-DO items):
- Expire emails after a certain period of time for security reasons
- Add more crypto functions for users to choose from to improve security
- Add a cooldown to prevent bruteforcing or DoSing the bot
- Add translations for other languages (e.g. Spanish, Chinese, Arabic)