Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Slash Commands #273

Open
wants to merge 8 commits into
base: hc2023-updates
Choose a base branch
from

Conversation

daniel-panhead
Copy link

@daniel-panhead daniel-panhead commented Jul 28, 2024

TL;DR

Fixed all existing slash commands except /start-verification, /add-members, and /check-email + migrated role-selector command to slash command.

All commands with persistent embeds/messages now also save info to Firebase so that they can continue to be used if the bot is restarted.

Description

  • /clear-chat - fix keep_pinned option
  • /self-care - fix self-care tip loading and message posting
  • /start-report - fix message sending
  • /discord-contests - fix question loading and posting
  • /load-question - fix question saving
  • /start-mentor-cave - add message ID saving functionality
  • /role-selector - converted from prefix command + add message ID saving functionality

Schema Changes

New collection: SavedMessages

  • New doc: 'mentor-cave'
{
    adminControls: { // stores info for admin control message
        channelId: string,
        messageId: string
    },
    extraEmojis: {
        [emojiIcon: string]: string // icon mapped to actual display name
    },
    requestTicketConsole: { // stores info for dropdown ticket request message
        channelId: string,
        messageId: string,
        publicRoleId: string,
        reminderTime: number
    },
    roleReactions: { // stores info for role reaction message
        channelId: string,
        messageId: string
    },
    ticketCount: number
}
  • New doc: 'pronouns'
{ // stores info for pronoun reaction message
    channelId: string,
    messageId: string
}
  • New doc: role-selector
{
    emojis: {
        [emojiIcon: string]: { // icon mapped to role info
            description: string,
            title: string,
            roleId: string,
        }
    }
    // Message info for reaction selector embed message
    channelId: string,
    messageId: string
}

New Collection: Questions

  • Each question doc (autogen ID) has the following schema:
{
    answers: string[] | number[], // array containing possible answers - set to empty array for manual graded answer
    asked: boolean,
    needAllAnswers: boolean,
    question: string
}

Questions can be loaded with the /load-question command where a json doc containing an array of objects with the above schema is uploaded.

New Collection: QuestionsLeaderboard

  • Each doc (autogen ID) represents a member on the leaderboard:
{
    memberId: string,
    points: number
}

New Collection: Reminders

  • Each doc (autogen ID) has the following schema:
{
    reminder: string,
    sent: boolean
}

Why

This allows logs to actually use critical Discord bot commands + more easily recover if the bot crashes (no more rerunning all the commands)

User Changes

No changes to the user experience - things work now :)

Tests Done

For each command, the functionality was tested + if containing persistent info, it was also tested that functionality continued to work after restarting the bot.

Breaking Changes

Commands were converted from referencing MongoDB info to referencing Firebase info.

@daniel-panhead daniel-panhead changed the base branch from develop to hc2023-updates July 30, 2024 02:55
@daniel-panhead daniel-panhead marked this pull request as ready for review August 12, 2024 07:26
@byronwang93
Copy link

DANG you're cracked i shall work on reviewing this today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants