TheOdinProject / odin-bot-v2

The bot that breathes life into our Discord community
ISC License
48 stars 77 forks source link

points and rotation commands: Escape markdown in display names #611

Closed T0nci closed 1 month ago

T0nci commented 2 months ago

Because

When users had markdown in their username/nickname(display name) and the bot printed the user's display name in some commands, the markdown wasn't escaped and it caused unwanted formatting in the bot's reply.

This PR

Issue

Closes #571

Additional Information

Pull Request Requirements

T0nci commented 1 month ago

Sadly I tried installing Redis through the CLI(with 2 methods on their site) and both times my VM wouldn't start up. So I had to remove it. Thanks for testing the rotation commands locally!

Yes of course! I was searching for the markdown-lint package and couldn't find it.

In what line is that? I can't seem to find it. I call getUsers in every test without a number, so I get all users from the function.

MaoShizhong commented 1 month ago

In what line is that? I can't seem to find it. I call getUsers in every test without a number, so I get all users from the function.

In all of your new tests for the rotation service, you call getUsers() without any args which will return the whole users array which you then slice out the first two elements. If you call getUsers(2) then it'll return the first two sliced out already, so no need to slice again.

(+ you wouldn't have found anything for markdownlint because it's not the curriculum repo and there's no markdown :P We use ESLint and Prettier in this repo)

T0nci commented 1 month ago

Oh I see. I was calling getUsers without args to get more users to simulate a more "real" test server(which doesn't make sense :/) and now I see that all that extra mock data is unnecessary. I will update the tests.

OH I only got it now lol, MARKDOWNlint for MARKDOWN files xD