-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat/Fix: Average Wait Time and Total Active Time stats Previously, the average session time was incorrectly calculated, it was the average helper session time, not average student session time. * Chore: formatting * Feat: `/settings` menu for google sheets Documentation doesn't exist yet so I haven't added it to the embed * Feat: `/settings` menu for serious mode and help topic prompt * fix: missing documentation links, error handling * style: organize base attending server Co-authored-by: Zhongning Li <[email protected]>
- Loading branch information
1 parent
c010169
commit cf49467
Showing
12 changed files
with
1,002 additions
and
595 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/extensions/google-sheet-logging/google-sheet-constants/google-sheet-settings-menu.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { EmbedBuilder } from 'discord.js'; | ||
import { EmbedColor } from '../../../utils/embed-helper.js'; | ||
import { SettingsMenuOption, YabobEmbed } from '../../../utils/type-aliases.js'; | ||
import { FrozenServer } from '../../extension-utils.js'; | ||
import { GoogleSheetExtensionState } from '../google-sheet-states.js'; | ||
import { mainMenuRow } from '../../../attending-server/server-settings-menus.js'; | ||
|
||
/** | ||
* Options for the server settings main menu | ||
* @see {@link serverSettingsMainMenuOptions} | ||
*/ | ||
const googleSheetSettingsMainMenuOptions: SettingsMenuOption[] = [ | ||
{ | ||
optionData: { | ||
emoji: '📊', | ||
label: 'Google Sheet Logging Settings', | ||
description: 'Configure the Google Sheet Logging settings', | ||
value: 'google-sheet-settings' | ||
}, | ||
subMenu: GoogleSheetSettingsConfigMenu | ||
} | ||
]; | ||
|
||
/** Compose the Google Sheet Logging settings settings menu */ | ||
function GoogleSheetSettingsConfigMenu( | ||
server: FrozenServer, | ||
channelId: string, | ||
isDm: boolean, | ||
updateMessage = '' | ||
): YabobEmbed { | ||
const state = GoogleSheetExtensionState.allStates.get(server.guild.id); | ||
if (!state) { | ||
throw new Error('Google Sheet Logging state for this server was not found'); | ||
} | ||
const setGoogleSheetCommandID = server.guild.commands.cache.find( | ||
command => command.name === 'set_google_sheet' | ||
)?.id; | ||
const embed = new EmbedBuilder() | ||
.setTitle(`📊 Google Sheet Logging Configuration for ${server.guild.name} 📊`) | ||
.setColor(EmbedColor.Aqua) | ||
.setFields( | ||
{ | ||
name: 'Description', | ||
value: 'This setting controls which Google Sheet this server will be used for logging.' | ||
}, | ||
{ | ||
name: 'Documentation', | ||
value: `[Learn more about Google Sheet Logging settings here.](https://github.com/KaoushikMurugan/yet-another-better-office-hour-bot/wiki/Configure-YABOB-Settings-For-Your-Server#google-sheet-settings)` //TODO: Add link to documentation | ||
}, | ||
{ | ||
name: 'Current Google Sheet', | ||
value: | ||
`[Google Sheet](${state.googleSheetURL}) \n ` + | ||
`To change the Google Sheet, please use the ${ | ||
setGoogleSheetCommandID | ||
? `</set_google_sheet:${setGoogleSheetCommandID}>` | ||
: '`/set_google_sheet`' | ||
} command. A select menu will be added in v4.3.1` | ||
} | ||
); | ||
if (updateMessage.length > 0) { | ||
embed.setFooter({ text: `✅ ${updateMessage}` }); | ||
} | ||
return { | ||
embeds: [embed], | ||
components: [mainMenuRow] | ||
}; | ||
} | ||
|
||
export { googleSheetSettingsMainMenuOptions, GoogleSheetSettingsConfigMenu }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.