Code and Design Specification
Code and Design Specification
(1) Requirements
Functional Requirements
Primary:
- Users can self-assign any study location roles that apply to them
- Users can append new study locations to the current list of study locations
- Users can communicate with other server members that are also in the same study location as them
- Users can update the status of their study locations(noise and busy-ness levels)
- Users can request to view a list of all possible bot command
Secondary:
- Users can create a private text channel to collaborate, communicate, and share notes with select members of the server
- Users can see the historical noise and busy-ness levels of a particular location
- Users can receive points for updating information about a location
Technical Requirements
Primary:
- Bot can accurately display all active study locations
- Bot can populate the current active study locations with a preset list of study locations
- With user input, the bot can add new study locations to the list of current locations
- Assign users’ self-assigned study location roles to the respective text channel for that study location
Secondary:
- Bot can clear users’ self-assigned location roles
- Bot can list all the users at a specific location
- Bot can dm a user to update their study locations
Usability Requirements
Primary:
- The list of study locations is easily accessible and readable
- Study locations and their respective reaction roles are organized in an intuitive way
- Bot commands are distinct and directions on how to use them are clear
- Nicely organizes and displays the noise and busy-ness levels of all study locations
Secondary:
- Customize reaction role emojis for user-created study locations in a reasonable manner
- Users can see which user created a new study location
- Users can see which users provided noise and/or busy-ness level statuses for each current location
(2) Storyboards
Scenario 1: Person 1 is struggling on an assignment and uses our bot to attract other students to work together with.
Figure 1: The storyboard for scenario 1.
Scenario 2: Person 1 is studying in location A, but it is too noisy to concentrate, so they use our bot to find a new place to study.
Figure 2: The storyboard for scenario 2.
(3) Architectural Design
Our Discord bot will consist of one file, bot.py
, which will contain all methods and event handlers as follows:
init()
- Sets up the bot to begin functioning in a server by creating a location role selection message and a preset study location for CSE2 Lab 1.
help(cmd=’’)
- Prints a help message describing the bot’s commands and usage in the channel that /help is typed by a user.
- Optional argument
cmd
allows users to specify a command to get more information (arguments, example usage, etc.) about. Acmd
value of’’
will result in a general help message being printed.
add_location(location)
- Adds a new location for
location
, creating an associated role, updating the location role selection message, and private text channel.
tag_location(location, duration=1)
- Assigns the role for
location
to the user. Afterduration
hours, removes the role from the user. - Can overwrite
duration
by calling the command again. - Tagging yourself at a location means that you’re opting in and willing to work with others.
- Throws an error if location does not exist.
- Only accepts specific building “prefixes”: CSE1, CSE2, Ode
- Optional argument
duration
allows the user to specify how long they want to hold the location role for.
list_people(location)
- Prints a message with a list of users currently holding the role of
location
. Does not mention the users.
list_info(location=’’)
- Prints a message with the noise and busy-ness levels of all locations tracked by the bot.
- Optional argument
location
allows the user to get the noise and busy-ness levels oflocation
for the past week.
update_noise(location, noise_level)
- Updates the noise level for
location
.
update_busy(location, busy_level)
- Updates how busy
location
is.
check_user(user)
- Sends a message to user to check whether they are still at a location after three hours of holding a location role and no text channel activity.
clear_role(user, location)
- Removes the location role for user.
set_cap()
- Allows the user to tell the bot to stop pinging people who are already in a location when new people join.
get_history(location)
- Prints a message with the noise and busy-ness levels of
location
for the past week.
(4) How Our System Description Enables the Requirements Described Above
Each of the functional requirements (including secondary requirements) described in part (1) corresponds to one or more methods of our system’s architectural design described in part (3). For the technical and usability requirements, we will leverage Discord’s existing interface and the discord.py
library to handle role and channel administration. Furthermore, the primary functional requirements correspond to the two tasks illustrated in our storyboards in part (2). Helping students find others to study with is accomplished via the functional requirements of users being able to self-assign location roles, add new study locations, and communicate with other students in a particular location. Helping students find places to study is accomplished via the functional requirement of users being able to view the noise and busy-ness levels of each location.