Skip to main content

WhatchaDoin Bot Design Document

Components

Chat Application

The chat application acts as both the bot's user portal and the bot's running environment. The chat application facilitates user interaction with the bot and allows it to act like a pseudo-user that can post and interact with messages. There will be a level of UI/UX design for the bot in Discord using both its API & libraries for command and interaction formatting as well as a block kit for formatting of modals, popups, and responses. The application will also act as the display for all data visualization that moderators ask for.

WhatchaDoin Bot

The bot itself is a chatbot that is hosted on Google Cloud via cloud run, as previously mentioned it will act as a pseudo-user posting messages and accepting and reacting to user responses with triggers. It interfaces with the Discord API to send messages and with the database to store and pull user reaction data. When dealing with moderation the bot will opt to DM moderators and generate either popups, modals, or interactive actions for approvals, data requests, or moderation features. When logging data the bot will leverage the server to send data to Firebase for storage.

Google Cloud Web Server

The Google Cloud web server provides a hosting point for the bot using the cloud run service. The server allows for two things, bot uptime and bot access to the database, through the server, the bot can make calls to the Firebase database both for logging and for access to data. The web server will also provide containers that host the Firebase database for reaction data. The web server also will be responsible for formatting data into visualizations when requested by the bot via a user.

Google Firebase Database

The Firebase database is contained in the cloud web server and acts as a means of storing and logging all reaction data. The database will contain data about prompts, approved submitted images, time to post, emoji reactions, threaded replies, and several comments. All of this data will be exportable as a CSV or in a visualization done by the host web server.

Class Diagram

WhatchaDoin Bot

This class will contain methods that allow the bot to interact with the users and moderator

Fields

-botName: Display name for the bot and how users and other members of the platform will recognize and refer to the bot

- botToken: Unique access token or authentication key that allows the bot to connect to the platform’s API and perform actions

- startHour: Hour of when the bot will start

- endHour: Hour of when bot will end

- promptList: List of all the prompts the bot can choose from

- blackList: List of users on the blacklist

Methods

-getCSV(): Gets the CSV fields

-getDatavis(): Checks for CSV fields by parsing lines from a file

-getOperatingHours(): Gets the operation hours of the bot

-sendPrompt(): Sends a prompt to a user

-getResponseDelay(): Gets the time it takes when the bot has to resend a prompt to the user

-getResponse(): gets response from the user

-setOperatingHours(int newStart, int newEnd): Sets the operating hours

-generateRandomPromptTime(): Generates a random time for when prompts are assigned

-generateRandomPrompt(): Generates a random prompt

-getPromptList(): Gets the prompt list

-setPromptList(): Sets the prompt list

-getResponsePostComment(): Gets and stores the response of a post comment

-setReponsePostComment(): Sets a response of a post comment

-getBlackList(): Shows the blacklist

-addUserToBlackList(): Adds users to the blacklist

-removeUserFromBlackList(): Removes a user from the blacklist

-selectRandomUserToPrompt(): Selects a random user to assign a prompt to

-getApprovalStatus(): Gets the approval status after sending a user response to the moderator

-setApprovalStatus(): Sets the approval status after sending a user response to a moderator

-sendToReponseToMod(): Sends a user response to a prompt to a moderator

-postReponseToChannel(): Posts the response of a moderator to a user to a channel

-deleteOriginalPromptFromChannel(): Deletes a prompt from a certain channel

-setaUsersAlreadyPromptedList(): Sets a list of users that were already prompted by the bot

Algorithms

Database Diagrams

Sequence Diagrams

Use Case #1: Owner of the Discord Server Configures the WhatchaDoin bot

Use Case 1 Discription

1. Owner signs in to Discord.

2. Owner opens the server "Preferences".

3. Owner selects "Apps and Integrations" and installs the WhatchaDoin bot.

4. Owner assigns roles and privileges to users in the community.

5. Owner defines moderation and content guidelines.

6. Owner defines type of prompts for WhatchaDoin bot to send properly suit the culture and vibe of their community.

7. Owner configures the schedule for WhatchaDoin bot, defining the hours when the it will send prompts.

8. Owner sets the duration for prompt responses to remain in the chat.

9. Owner sets the amount of time users have to respond to prompt notification.

10. Owner saves the configuration settings.



Use Case #2: User Responds to a WhatchaDoin bot Prompt

Use Case 2 Discription

1. User in the Discord community receives a notification at a random time of day that they have received a prompt from the WhatchaDoinBot bot.

2. User opens Discord.

3. User responds to the random prompt by taking a picture and uploading it.

4. User replies to the WhatchaDoinBot bot with their response to the prompt, which is sent to the moderator.

5. User waits for approval status from the WhatchaDoinBot bot.



Use Case #3: User Does Not Respond to a WhatchaDoin bot Prompt

Use Case 3 Discription

1. The WhatchaDoinBot bot waits until timeout.

2. The WhatchaDoinBot bot sends a notification to the Discord user.

3. WhatchaDoinBot bot recognizes the user’s failure to respond, and sends a reminder notification to the users about the missed prompt.



Use Case #4: User-Submission approved

Use Case 4 Discription
  1. WhatchaDoinBot bot receives the approval decision.
  2. WhatchaDoinBot bot posts the image with the caption and notifies the user.
  3. WhatchaDoinBot bot logs emoji reactions, threaded replies, and comments from the community.
  4. WhatchaDoinBot bot sends logs to the server.


Use Case #5: User’s submission is denied

Use Case 5 Discription

1. User receives a notification that the post was not approved and is asked to resubmit with feedback.

2. User resubmits the image.

3. User receives a notification that the post was approved and it was posted.



Use Case #6: User Reacts to a New Post Notification

Use Case 6 Discription

1. A user in the Discord community is notified by the WhatchaDoinBot bot that another user has posted a response to a prompt.

2. User opens Discord to view the response in the Discord community channel.

3. User interacts with the post by leaving a comment or a reaction(likes, emojis, etc).



Use Case #7: User ignores New Post Notification

Use Case 7 Discription

1. A user in the Discord community goes to the settings of the WhatchaDoinBot bot.

2. User chooses an option to turn off new post notifications.

3. The user is no longer sent another post notification.



Use Case #8: Moderator Accesses Reaction Data in Database

Use Case 8 Discription
Normal Flow:
  1. Moderator logs into Discord.
  2. Moderator runs a command to request reaction data in csv format.
  3. Moderator exports reaction data for further analysis, if needed.
Use Case 8 Alternate Discription
Alternate Flow:
  1. Moderator logs into Discord.
  2. Moderator runs a command to see reaction data.
  3. Moderator receives data visualizations from bot.


Use Case #9: Moderator makes approval status decision

Use Case 9 Discription

1. Moderator receives notification about a user submission.

2. Moderator opens Discord.

3. Moderator reviews submission using predefined criteria from community guidelines.

4. Based on guidelines, moderators approves or rejects submissions.

5. Moderator marks submissions as “Approved” or “Denied” to bot.



Use Case #10: WhatchaDoin Bot bans user from prompting after mupltiple denails

Use Case 10 Discription

1. WhatchaDoinBot counts DENIALS (strikes) recieved by users within the Discord community.

2. WhatchaDoinBot bot sends a warning notification to the user about strikes.

3. WhatchaDoinBot bot notifies moderator about the DENIALS and how close they are from the blacklist.

4. If the user continues to recieve DENIALS, WhatchaDoinBot adds the user to the blacklist.

5. WhatchaDoinBot bot logs the action to blacklist log.



Use Case #11: Moderator manages blacklist

Use Case 11 Discription
Normal Flow:

1. Moderator chooses to add user to blacklist.

2. Moderator runs a command to view the blacklist and sees added user.

Use Case 11 Alternate Discription
Alternate Flow:

1. Moderator chooses not to add user to blacklist.

2. Moderator views the blacklist and sees another user they want to remove.

3. Moderator runs a command to remove the user from the blacklist.

4. Moderator views the blacklist and no longer sees removed user.