Releases: KaoushikMurugan/yet-another-better-office-hour-bot
v4.4 Release
Change Log:
Help Command is now fixed! #101 #148
- The /help command now prompts a menu to let you choose a command that you need help with.
Using ISO Date format and Time Zones #150 #153
- YABOB will now log the date and time of events in ISO Date format in the google sheets. In addition to this it will also log the unix epoch time. A
/set_time_zone
has also been added to allow customization since previously the bot was set to logging times in PT.
Bulk assign helpers their queue roles! #87 #152
- Use the
/assign_helpers_roles
and pass in a csv file to assign helper the queue roles! - csv file must be in the following format
discord_id1,queue_name1,queue_name2
discord_id2,queue_name1,queue_name2,queue_name3
discord_id3,queue_name4
...
- The queue names checks are case sensitive
- Gives the user the Staff role if they don't have it already
- Does not remove the staff role from users not in this list
Removed many /set_...
and replaced them with /settings [sub menu name]
redirect commands #135 #149
- Many
/set_...
commands were doing the same thing as some/settings
menus but the settings menu provided more information and was more useful to users. The following commands were removed:/set_after_session_msg
/set_queue_auto_clear
/serious_mode
(voided #129)/auto_give_student_role
/set_google_sheet
/set_calendar
/unset_calendar
/set_public_embed_url
- To have the same level of ease, we added an option to the command:
/settings [sub menu name]
to jump directly to a particular sub menu
Added back commands /queue_notify [on|off]
and that correspond to the Join and Remove Notifications buttons #45 #149
/next
now displays the help message that the student entered, if any
v4.3.0
New Features!
-
Settings Menu
YABOB now has the
/settings
command that lets you easily configure all sorts of settings! Learn more about YABOB settings here. -
/stats
command for helpers and bot admins/stats helper
This command reports help session data of the user within a specified time period./stats server
This command reports help session data of the entire server within a specified time period.Calculates the following statistics:
- Total number of help sessions
- Total session time
- Total number of students sessions helped
- Number of unique students helped
- Total number of returning students
- Average Session Time
-
/weekly_report
command. Show the following stats for each week for the pastn
weeks. Hashelper
andserver
sub-commands similar to the/stats
command.Statistics calculated:
- Number of help sessions
- Total session time
- Number of students helped
-
Per server attendance tracking to avoid overloading a single google sheet
You can configure which google sheet to write to with
/set_google_sheet
. -
Ask students for what they need help with when they join a queue
When pressing the
join
button or sending the/enqueue
command, students will now be prompted with a modal asking them what they need help with. This feature can be disabled via the/prompt_help_topic off
command. Use/prompt_help_topic on
to re-enable this feature. Helpers of the queue the students will be notified of the help topic.
*Note: Students will be added to the queue before being prompted by the modal, and submitting the modal is not required. -
Closing queues without stopping
You can now use the
/pause
command to mark yourself as "paused" and temporarily stop accepting new students. If all helpers of an open queue used /pause, the queue becomes PAUSED. A PAUSED queue allows students to be dequeued but prevents new students from joining.Use the
/resume
command to become an active helper again. -
New utility command
/create_offices
. You can batch create office hour voice channels and let YABOB configure the permissions for you. -
You can now toggle YABOB's feature of automatically giving the Student role to new members with the
/auto_give_student_role
command. You can also configure this feature via the new/settings
command.
Feature Changes & Performance improvements
-
Roles revamp
-
Previously, YABOB would automatically create roles with the names
Bot Admin
,Staff
andStudent
. Additionally, the bot would check by the role name to ensure if a user is permitted to use a feature.In the revamp, we have made the role checks based on role id instead. Use the
/set_roles
command to set the roles forBot Admin
,Staff
andStudent
.Using role ids instead of role names allows more flexibility with the roles, e.g. you could have pre-existing roles like
@Moderator
,@Tutor
and@Member
and assign them toBot Admin
,Staff
andStudent
respectively -
Via the
/settings
roles menu, you have 4 different quick start options to setup the roles. See the configuration guide for a detailed explanation -
When YABOB joins a new server, it will prompt the server owner with a message similar to the
/settings
roles menu with the same options
-
-
Calendar Embed now has a
Link to Calendar
button. The embed's title no longer functions as a link. -
/when_next
now has ashow_all
option to display as many upcoming office hour sessions as possible.
Bug Fixes
- Fixed the issue of removing queue roles while helping causes some queues to not close when /stop is used.
- Reduced the google sheet update frequency and update attendance entries in big batches to prevent update failures
Internal changes
- Calendar and Google Sheets Extensions Refactored to support more complex logic
v4.2.0 Release
New Features!
-
New commands
/serious_mode on
and/serious_mode off
to disable emoticons and other "fun" features per server.- Currently removes the emoticons used in queues
-
YABOB now shows a discord Presence!
- Randomly updates to a new presence every 30 minutes
- You can find the full list of presences it can show in this file
-
Queue auto clear now has display support! If an auto clear timer is started, the queue will now show a dynamic countdown to when the queue will be cleared.
-
When a queue is open, the voice channel status of all the active helpers will be displayed in the
Currently Available Helpers
embed.
Feature Changes & Performance improvements
-
Embeds that display YABOB's profile picture will now dynamically use the bot client's avatar instead of using the hardcoded Imgur link.
- YABOB will use the avatar that you set it to use in discord's developer portal
- If you update the avatar while the bot is running, you don't need to restart the bot as the avatar is dynamically fetched.
-
Using Discord Modals (basically forms) for
/set_after_session_msg
and/set_queue_auto_clear
- Entering these commands will now prompt a modal (aka a form) with text box that you can fill out and submit.
- Benefits of modals:
- You can now have newline characters (by pressing
Shift
+Enter
) in your after session message - Limit to 2 digit number for hour and minutes for queue auto clear timeout.
- You can now have newline characters (by pressing
-
/list_helpers
now displays a helper's vc status -
Faster
/start
,/stop
,/next
and queue updates #82
Bug Fixes
-
Fixed issues with voice channel links
a. Links sometimes didn't work. This is now fixed
b. Permission Overrides now gets revoked after a student finishes their session.
-
Display error messages when discord.js returns an error. #88
-
Fixes the issue where students loaded from firebase backup cannot be correctly dequeued
Internal changes
-
Firebase is now a built-in feature and no longer an optional extension.
- This means that to set up your own YABOB, you must have the firebase credentials setup.
-
Client object is now a global object and can be accessed in any file. Type is
Client<true>
. This object is guaranteed to have non-null user properties. -
Moved success and error messages to separate files:
a. Server Errors: src/attending-server/expected-server-errors.ts
b. Base Interaction Errors: src/command-handling/builtin-success-messages.ts, src/command-handling/expected-interaction-errors.ts
c. Calendar Extention Errors: src/extensions/session-calendar/calendar-success-messages.ts, src/extensions/session-calendar/expected-calendar-errors.ts -
Better uncaught error handling #59
-
Now using ESModules instead of CommonJS to allow top level await.
-
Generated developer documentation using
typedoc
andtypedoc-plugin-merge-modules
!- Can be found here
- Generated via the command
npm run makeDoc
.
-
Updated to the newest NodeJS LTS version (v18.12.0)
v4.1.0 Release
New Features!
- Emergency fix: (from the google sheets library) Google sheet titles cannot have colons in them.
- Updated credential formats:
- New files
src/environment/development.json
andsrc/environment/production.json
- More details in the setup page
- New files
- New
/help
command- Parameter: command
- Uses the pre-existing help messages in
help-channel-messages/
and any made in extensions
- New Type
HelpMessage
to encapsulate the help messages that are displayed in the bot help channels and help messages that can be viewed via the new/help
command. All existing help message embeds converted to this type.- Type structure:
type HelpMessage = { nameValuePair: [name: string, value: string], // used by /help command parser useInHelpChannel: boolean, // whether it's displayed in help channels useInHelpCommand: boolean, // whether it's displayed by /help message: BaseMessageOptions // The actual message };
- Easily create help messages and choose if you want the help command, help channel or both to display them
- Type structure:
- Optional Logging on discord servers
- If you set a channel for logging, YABOB will log:
- When someone presses a button or uses a slash command (all interactions)
- When backups happen
- When errors in interaction processing occur
- By default, doesn't log per server
- New commands:
/set_logging_channel
to set the channel you want to see YABOB logs/stop_logging
to stop YABOB from posting logs
- If you set a channel for logging, YABOB will log:
- Automatic Queue Clearing
- The bot can now automatically clear the queue after a bot-admin-specified amount of minutes from when it was last closed
- Use the
/set_queue_auto_clear
to set this time - This feature is disabled by default per server
- Backups are now event based instead of timer based
- The bot will trigger a firebase backup whenever the following events happen:
- A student is added or removed from a queue
- A queue is cleared (i.e.
/clear
command) /set_after_session_msg
,/set_logging_channel
or/set_queue_auto_clear
- The bot will trigger a firebase backup whenever the following events happen:
- Public Calendar Embed Override
- You can now set a custom calendar link the the session calendar embed!
- Use
/set_public_embed_url <new link> enable=true
to enable the override. This will trigger a backup. - Use
/set_public_embed_url <any random string> enable=false
to fall back to the default google calendar embed
Dependencies and Packages
v4.0.0 Release Candidate
The first running release of YABOB V4!
See the documentation
Currently Developed New Features
-
Modular
AttrendingServerV2
andHelpQueueV2
- On
create()
server will load server extensions and queue will load queue extensions - All creations/initializations are launched synchronously so 1 server or 1 queue won't block any other. It's safe because individual servers and queues never have access to other ones and one instance's setup progress does not influence another. The main client will wait for them to all finish.
- Both
AttrendingServerV2
andHelpQueueV2
support event based (when someone uses a command / queue content change / queue render) emitters and periodic event emitters. - Once an event emits, all extensions that override corresponding methods will be launched synchronously and not block main server operation.
- Queue renderer can be injected with non queue embeds. Every queue extension will get an
renderIndex
which represent its order in the list of embeds. Extensions only need to provide the complete embed, andQueueDisplayV2
will help maintain the #queue channel integrity by doing checks and ask HelpQueue to trigger a clean render if necessary. Checks are done in$O(1)$ and clean render will not happen unless a message gets deleted or /cleanup was used, so there's minimal overhead when it comes to normal re-renders.
- On
-
Unified
CommandHandler
andButtonHandler
- Every interaction now follow this flow:
-
Client receives interaction, checks if the built in handlers can process it, then directly pass to the corresponding handlers.
-
CommandHandler
andButtonHandler
look up functions by interaction name inmethodMap
hashmap -
Immediately reply to the user saying it's processing to provide feedback.
-
Launch all asynchronous checks.
ButtonHandler
will always check for valid queuei. They follow this syntax: (example: checks for
/enqueue
)const [serverId, queueChannel, member] = await Promise.all([ this.isServerInteraction(interaction), this.isValidQueueInteraction(interaction), this.isTriggeredByUserWithValidEmail(interaction, "enqueue"), ]);
Checks are decoupled from individual commands so they are easily reusable. If all checks pass, the command will continue with values guaranteed to be clean.
-
Calls the corresponding server's function if the checks pass. Otherwise reject with
CommandParseError
. -
Wait for the server/queue to finish. If they reject, pass the error back to the user.
i. Current errors designed to be sent back to the user include
ServerError
,QueueError
,CommandParseError
, andCommandNotImplementedError
-
- Every interaction now follow this flow:
-
Currently Implemented Extensions
- [Server] Firebase Extension: Automatic backup every 30 minutes(arbitrary, change if needed). Automatic reload from firebase on server startup
- [Queue] Calendar Extension: Reads the given google calendar and looks for upcoming tutoring sessions. Injects upcoming sessions' embed into the queue renderer
- Added a button to allow manual refresh of the upcoming sessions calendar. I hope google doesn't think we are doing ddos attacks.
- [Command] Calendar Extension: This is coupled together with the queue one. Posts the following commands:
-
set_calendar
: Admin only, switches to a different calendar -
when_next
: Everyone, lists upcoming tutoring sessions in the next 7 days. -
make_calendar_string
: Staff or Admin, make a calendar string that the queue extension can parse.
-
- [Server] Attendance Extension: Same as the current attendance tracking method. Reads the google sheet, computes help time every time a tutor uses /stop, then add a new row.
-
Guild kick and rejoin
- If YABOB accidentally gets kicked from the server, simply re-invite YABOB and it will DM the server owner to adjust the roles. Once the roles are adjusted (give YABOB the highest role), then it will DM the owner again to say it's ready. It will now perform the normal server initialization sequence using any backup it can find.
-
About Roles
- YABOB doesn't rely on role positions anymore to limit user permissions. It will strictly check for the exact name of the role, giving server admins the freedom to adjust specific permissions. This keeps YABOB's behavior simple and easy to debug. If YABOB is not limiting user permissions correctly, then it must related to the role names.
- To change role permissions for individual commands, change the role names in
isTriggeredByUserWithRoles
. Role names here have OR relationship meaning that if the user satisfy one or more of the roles, the permission check will pass.
-
Dev Utilities
- YABOB is now runnable without any extensions. Enable the
-- noExtensions=true
flag to disable all extensions. -
npm run dev
andnpm run prod
are setup if we need to separate dev and production environment. Both will compile then immediately start running the bot so we don't need tonpm run build
thennpm run start
. This requires all TS checks to pass.
- YABOB is now runnable without any extensions. Enable the