Skip to content

removereminder

Colton B edited this page Oct 23, 2024 · 2 revisions

/removereminder Command

The /removereminder command allows users to remove snitch or pearl reminders from their reminder list. This command offers various options for removing specific reminders, bulk removing snitches based on their namelayer, or even deleting all reminders.

Command Structure

/removereminder [subcommand] [options]

Subcommands:

  • pearl
    Removes a specific pearl reminder.

    • Required option:
      • name (string): The name of the pearl reminder to remove.
  • snitch
    Removes a specific snitch reminder.

    • Required options:
      • name (string): The name of the snitch reminder.
      • coordinate (string): The coordinates of the snitch reminder.
  • bulk
    Removes multiple snitch reminders associated with a specific namelayer.

    • Required option:
      • namelayer (string): The namelayer associated with the snitches to be removed.
  • all
    Removes all reminders (both snitch and pearl) owned by the user. This is a dangerous action that requires confirmation.

Command Flow:

  1. Subcommand Execution:
    The user invokes the command with one of the four subcommands: pearl, snitch, bulk, or all.

  2. Database Search:
    The bot searches the reminder database for the user’s reminders. For:

    • Pearl reminders: It matches the name provided with the user's reminders.
    • Snitch reminders: It matches the name and coordinate provided with the user's snitch reminders.
    • Bulk removal: It matches the provided namelayer with the user’s snitch reminders.
  3. Reminder Deletion:

    • Once a match is found, the bot deletes the relevant reminder from the database.
    • It also removes any related cached data from the in-memory cache using the CacheManager.
  4. Confirmation for 'all' Subcommand:

    • For the all subcommand, the bot prompts the user with confirmation buttons. Upon confirmation, all reminders are deleted, otherwise the action is canceled.

Usage Examples:

/removereminder pearl name: MyPearlReminder

This removes the pearl reminder named MyPearlReminder.

/removereminder snitch name: MySnitchReminder coordinate: -100,64,250

This removes the snitch reminder named MySnitchReminder located at coordinates -100,64,250.

/removereminder bulk namelayer: MyNamelayer

This removes all snitch reminders associated with the namelayer MyNamelayer.

/removereminder all

This triggers a confirmation prompt to delete all reminders owned by the user.

Confirmation Flow for all Subcommand:

  1. The user invokes the /removereminder all command.
  2. The bot sends a confirmation prompt with Confirm and Cancel buttons:
    • Confirm: Proceeds with deleting all reminders.
    • Cancel: Aborts the action, and the reminders remain intact.
  3. If no response is received within 15 seconds, the operation is automatically canceled.

Error Handling:

  • If the provided reminder name (or coordinates in the case of snitches) does not match any reminders, the bot responds with an error message asking the user to check their input.
  • For the bulk subcommand, if the namelayer provided does not match any of the user’s reminders, an error message is returned.
  • If there is an issue with deletion (e.g., no matching reminders are found), the bot returns a message indicating the problem.