Verification via email
- Python 97.9%
- HTML 2.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| config.example.yaml | ||
| functions.py | ||
| main.py | ||
| message.html | ||
| README.md | ||
veribot
Discord bot for verification via (TTU) .edu email accounts.
Usage
Automatically, the bot will log:
- Username, display name and avatar changes.
- Messages entered in the quarantine channel.
- Email addresses entered by users.
- If any incorrect usage is detected, and by who. Additionally, the bot will automatically delete messages sent by non-admins in the quarantine channel.
App Commands
verify <email>- User-facing.
- Takes the
emailstring as an argument, makes sure that it is a (TTU) email address, then sends an email containing a One-Time-Passcode to it.
otp <OTP Key>- User-facing.
- Takes the
OTP Keystring as an argument, casts it to an integer then checks if it matches the One-Time-Passcode on file. - If it matches, it grants the user access to the rest of the Discord server.
- If it does not match, it removes one of the three tries.
- At the end of the three tries, it institutes a 30 minute countdown on the
verifycommand for the user and removes the One-Time-Passcode on file.
Dependencies
python >3.12
discord.py 2.4.0
PyYAML 6.0.1
Email is sent over SMTP submission via the standard-library smtplib/email modules (compatible with Stalwart and any other SMTP server), so no extra mail dependency is required.
Installation
Server-Side
- Clone the repository using
git clone https://github.com/Linux-Open-source-Computing-Org-LOCO/veribot.gitinto the directory where you want to install it. - There is one file and a directory that need to be created and populated before you launch the bot.
- Create the directory
.cacheusing the commandmkdir .cachewithin the veribot directory. - Create
config.yamlby copying the provided template:cp config.example.yaml config.yaml. - Populate
config.yamlwith your own configuration (all secrets and settings live here — replace the placeholder text):
- Create the directory
discordToken: "string" # Discord Bot token
guildID: integer
channels:
quarantineChannelID: integer
logChannelID: integer
deletedMessagesChannelID: integer
roles:
verifiedRoleID: integer
adminRoleID: integer
text:
fullClubTitle: "string"
emailAddress: "Example String <example@example.com>"
emailSubject: "string"
status: "string"
smtp:
host: "mail.example.com"
port: 587
username: "verify@example.com"
password: "string" # SMTP password for the account above
security: "starttls" # starttls (port 587), ssl (port 465), or none
+ The IDs can be found by enabling "Developer Mode" on your Discord account, then opening the context menu of the relevant item. + Internally, Discord servers are known as guilds. * Ideally, you would run the bot in a screen. + Ensure you have the `screen` program installed. + You can enter a screen by typing `screen` into the console. + You can reenter a screen by typing `screen -r `. + You can list active screens by typing `screen -ls`. + You can exit a screen by pressing the key combination: `C-a d`. (aka `ctrl` + `a`, then `d`) * Next, run the bot by typing `python3 main.py`.
Client-Side
- You will need at least:
- A quarantine channel, and a log channel.
- An administrator or moderator role (can post messages in the quarantine channel).
- A "verified" role that can see the rest of the public server, but not the quarantine channel.
- Configure the default @everyone permissions to be minimal.
- Configure the server so that @everyone can only see the quarantine channel.