Skip to content

Instantly share code, notes, and snippets.

@RIGIK93
Last active September 20, 2022 02:31
Show Gist options
  • Save RIGIK93/b64615332913c466cde274dd4e479d2f to your computer and use it in GitHub Desktop.
Save RIGIK93/b64615332913c466cde274dd4e479d2f to your computer and use it in GitHub Desktop.
Email Verification Bot For Discord (Concept)

Email verification bot for discord

Tech Stack

Database: Surreal DB
Host: Docker
Lang: TS, node
Communication: RabbitMQ
Mailing Service: MailGun
Web Server: SvelteKit (Prefferable)/SolidJS SSR

Plan

Verification Process:

flowchart LR
Client -.-> DiscordJS
Email --> MailGun --> Client
VS -.- Client
subgraph Backend
DiscordJS -->|RabbitMQ| Email
Email[Email Handler] -->|RabbitMQ| VS
VS -->|RabbitMQ| Email
VS --> DB[DB Handler]
DB --> DiscordJS
VS -->|RabbitMQ| DiscordJS
VS[Verification WebServer]
end
Loading

Step By Step:

Init

  1. User enters email in Discord
  2. Discord JS checks if email is verified (email is busy / user is already registered) if not:
  3. Discord JS sends user's email to Email Handler
  4. Email Handler requests verification link from verification web server
  5. verification web server creates a db record in pending db
  6. Email Handler recieves verification link
  7. Email Handler sends verification email via mailgun

Confirm

  1. User clicks the link
  2. Webserver moves record from pending to main
  3. Webserver sends request to DiscordJS to change user's Role to verified

Update

  1. Discord JS changes user's role and nickname (if specified)

Db record

string tag; (ex. RIGIK93#2549)
string email; (ex. something@example.com)
string name; (name specified in the email)
Date createdAt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment