Skip to content

Conversation

kristersd
Copy link
Contributor

@kristersd kristersd commented Mar 10, 2024

Closes #354

Copy link

what-the-diff bot commented Mar 10, 2024

PR Summary

  • Enhanced commands.ts with improved import statements
    The commands.ts file has been updated to import specific modules from discord.js which increases the efficiency and speed of the code.

  • Refined handleMessage function
    The handleMessage function in commands.ts has now been modified to utilize the extractSearchKey helper function rather than splitting up the message content. This change simplifies the code and makes it easier to maintain in the future.

  • Improved readability of generateReactDocsErrorEmbeds function
    The generateReactDocsErrorEmbeds function now uses multi-line object literals. This makes the code easier to read and comprehend.

  • Added unit tests for helper functions
    A new file react-docs.test.ts has been added which contains unit tests for the extractSearchKey and getReactDocsSearchKey functions. This ensures that the functions behave as expected and improves the overall reliability of the system.

  • Improved react-docs.ts with new function and constant
    The EXTRACT_SEARCH_KEY_REGEX constant and the extractSearchKey function have been added to react-docs.ts. This helps the system in more effectively extracting the search key from a message.

  • Code formatting and commenting for react-docs.ts
    To improve code readability and maintainability, react-docs.ts has been formatted and detailed comments have been added where necessary.

@kristersd kristersd requested a review from vcarl March 10, 2024 13:29
@kristersd kristersd force-pushed the ortunado/incorrect-docs branch from 86fb09d to 3213abe Compare March 10, 2024 15:39
Copy link
Member

@vcarl vcarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! tyty

import { describe, expect, test } from "vitest";
import { extractSearchKey, getReactDocsSearchKey } from "./react-docs";

describe("React documentation command", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@vcarl vcarl merged commit 0524b83 into main Mar 10, 2024
@vcarl vcarl deleted the ortunado/incorrect-docs branch March 10, 2024 18:36
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.

Search React documentation doesn't recognize keywords correctly

2 participants