Weblutions Documentation
Weblutions Main Site Contact Us Our Discord
Some pages are still pending proper formatting, if required refer to the legacy documentation website.
Commission Docs IconCommission Docs

Users with Discord Role

By Josh M. 2 mins 3

A Discord bot that collects data from users with a specific role and then displays it on an openly accessed website which will have the data displayed in a table.

Table of Contents:


Data collected includes:

  • ID

  • Username

  • Roles

  • Join Date

  • Avatar

Technologies Used:

This will be written in JavaScript using Discord.js and Express.js libraries to obtain and display the collected data.

Technical Flow:

  • Every x seconds/minutes (rate limit depending) the bot collects users that have a role within the configuration of roles.

  • If the user has a role, the above data is collected and stored in the applications memory

  • The data is then displayed via the Express.js web-application on a variety of routes, both in an API and rendered state.

  • Whatever is desired can be done with this data

Express Routes:

  • A rendered route will be on the applications index, and;

  • An API route with raw JSON data will be located via GET /api

  • With the code being open, these routes can always be changed

Express Security:

No login will be required for the rendered page as per discussion. If the API route is wanting to be locked, that can be organised within the scope of the quote at no additional cost.

File Structure

users-with-role/
├─ webapp/
│  ├─ static/
│  │  ├─ main.css
│  ├─ views/
│  │  ├─ index.ejs
├─ index.js
├─ package.json
├─ package-lock.json

Preview

https://weblutions.com/u/DGD9Il.mp4

Installation & Usage

  1. Download and extract the contents of the RAR file

  2. Edit the ENV configuration file to your own liking

  3. For the Discord bot, make sure all intents are selected

  4. With Node/NPM run npm install from within the install location in a command prompt or shell

  5. Start the application with node . to start the application

Default Configuration File

# The Discord server ID to be monitoring 
GUILD_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Role IDs which can be multiple by using a comma
ROLE_IDS=roleid1,roleid2,roleid3
# Whether to use server nicknames or the users username
USE_NICKNAMES=true
# The Discord bot token, all intents should be enabled
DISCORD_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# The port the express application will run on
EXPRESS_PORT=3000


Thank you for ordering a commission from Weblutions
If you require additional support
contact us