gssocFAQ-Bot icon indicating copy to clipboard operation
gssocFAQ-Bot copied to clipboard

[FEAT] Query FAQs by Number

Open praaachii4596 opened this issue 1 year ago • 4 comments

Feature Request: Add Ability to Query FAQs by Number in /faq Command

Description

Currently, the /faq command supports autocomplete for FAQ questions, allowing users to select their question easily. However, users must type or select the full question text. It would be very useful and user-friendly if users could also query the FAQ by simply typing the number of the question as shown in the "all commands" paginated list.

For example:

  • When a user types /faq question: 5, the bot should reply with the answer to the 5th FAQ directly.
  • This complements the current autocomplete feature and the paginated FAQ list feature.

Motivation

  • Simplifies quick access to FAQ answers using simple numeric input.
  • Provides a faster way to get answers without searching full text.
  • Aligns with the existing paginated numbered FAQ list shown by /faq question: all commands.
  • Improves overall user experience and accessibility.

Proposed Implementation

  • Parse user input for /faq question to detect if it is a number within range.
  • If a valid number is detected, reply with the corresponding FAQ answer.
  • If invalid number provided, reply with a helpful error message.
  • Maintain existing question text matching and autocomplete functionality.
  • Update the documentation and "all commands" page to mention this numeric query feature.

Additional Information

  • A similar pagination feature with buttons has been implemented recently by me.
  • Can reuse the current numbered FAQ list order to determine mapping between number and question.
  • Ideally, add simple unit or integration tests for this feature.

I would like to contribute this feature if maintainers are open to it. Please let me know if you have any specific guidelines or preferences for implementation!

Thank you!

praaachii4596 avatar Jul 29 '25 11:07 praaachii4596

Checklist: Please confirm the following checks when submitting the pull request,

It help us ensure the completeness of the project:

  • [x] Attach Proof of Work - Include at least one screenshot or short video showing the bot or feature working inside Discord.
  • [x] What problem you are solving, Explain Your Approach In your PR description
  • [x] PR links to the issue (e.g., Closes #12)

@praaachii4596 I see you're now a Pro contributor, great work! I noticed you implemented FAQ pagination, and I really liked it. That really elevated the user experience. Just a quick reminder: please ensure that text autocomplete remains intact with this new feature, and that all previous functionalities continue to work as expected. I will Promote your level later.

Also, I'd appreciate a video demo showcasing the implementation.

Following this checklist helps maintain quality and makes life easier for reviewers.

piyushpatelcodes avatar Jul 29 '25 15:07 piyushpatelcodes

Hi @piyushpatelcodes !

I’m really confused rn about how to implement this feature as per the user experience because there are endless ways. So could you suggest me what implementation would be better.

Here are a few implementation options:

  1. Number Input in /faq Command:

    • Users type the number as the question argument (e.g., /faq question: 5), and the bot replies with the answer to question 5.
    • This extends the current command, is easy to use, and doesn’t add new commands.
    • Can also be triggered by replying to the bot's command.
  2. Short Number-Only Slash Command:

    • Add a new quick command (e.g., /q or /n) that takes just a number (e.g., /q 5) to get an answer.
    • Very fast/short for users, but increases the number of commands.
  3. Interactive FAQ Selector via Dropdown:

    • When the "all commands" list is shown, also provide a dropdown menu of the current page's questions.
    • Users can select a question from the dropdown to see the answer instantly.
Image Image

Question:
Which implementation do you feel best suits the user expectations?

  • I’m happy to proceed with whichever option is preferred or if there is any other suggestion.

Thanks so much for your feedback! I would love to proceed as soon as I get a reply because I have the code already for when I was testing.

praaachii4596 avatar Jul 29 '25 19:07 praaachii4596

@praaachii4596 Hi, You've already implemented Approach 3, which looks great. My only concern is whether all questions are available in the dropdown currently, it seems to display only one page of questions, which is totally fine. i would like to also support Approach 1, such as /faq question:2. While the question: field typically accepts an autocomplete string, if the user provides a number, it should directly return the answer for that specific question number. Let me know your thoughts! Is this implementation possible while retaining your current implementation. You can take as much as time you like for the prototyping and give me a yes/no by replying here.

piyushpatelcodes avatar Jul 30 '25 07:07 piyushpatelcodes

@piyushpatelcodes yes I tried implementing both these approaches exactly like you suggested. Need you to review or suggest any improvements.

https://github.com/user-attachments/assets/cb5b88f2-7c37-4e63-86bb-35a2bf1c4516

praaachii4596 avatar Jul 30 '25 08:07 praaachii4596