-
Notifications
You must be signed in to change notification settings - Fork 77
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
Bug - points command: Symbols aren't escaped #571
Comments
This should be a relatively easy fix since discord.js has its own built-in escaper, |
Yep,
Various methods in Both of these have their corresponding @T0nci is this still something you wish to work on? |
@MaoShizhong Yes, I'd love to work on this! Although since this is my first contribution involving code that isn't HTML or markdown lol, if I can't finish the task I'll ask for help or ask for it to be reassigned to someone that can complete it. |
Assigned. Feel free to ask about any problems or uncertainties. Local bot setup instructions are in this repo's wiki. I think for the points stuff you won't be able to directly test some points things in your test discord server since there's an intermediary bot that I don't think we have a dev version for (not too familiar with that part myself but it was mentioned at some point in our staff channels), but the Jest tests for those should still run fine, hence we need them amended to test the escaped behaviour. |
@T0nci just a courtesy check in on this in case you need any help or clarification? |
@MaoShizhong Will get on it in the next few days! Had a break from coding for a while and just got into the flow again, so I'll look into it. Apologies for the long period it's taking me to complete this contribution. |
No worries, real life comes first and breaks are important 👍 Let me know here if you need any assistance at any points. |
@MaoShizhong So while fixing the leaderboard subcommand, I noticed that there is an extra backslash when there is a `, although I'm guessing that's because jest is using template literals and needs to escape all `s. Is it fine if I leave this test(and possibly all other tests that will include `s) like this? All other markdown is escaped correctly. |
As long as the visual output from the command is correct and all tests pass with the appropriate snapshots, that's fine. If the snapshot requires additional backslashes, then it needs them.
|
@MaoShizhong I have a problem with completing the second part of the task. I'm confused how the code works, and in turn don't know what and how to test. I may have pinpointed the part where I'm supposed to include the I have successfully completed integrating the |
@T0nci Yep, you've isolated the correct function. You can actually test the rotation commands locally in your test server since you'll be an admin in that. We could probably even change that map callback's returns to this.displayNames = members.map(async (memberId) => {
const member = await server.members.fetch(memberId);
return escapeMarkdown(member.nickname || member.user.username);
}); |
@MaoShizhong That's great, I'll try to implement this too once I get better from my illness. The part that was bugging me and still is, is that I don't really know how the command works so I can change the tests correctly. I've tried using it in my discord server with an odin-bot setup(through the steps in the docs) but crashes after the points leader and user commands and the rotation commands(not too sure about all rotation commands that's why I'll try to use them again tommorow) so I couldn't use the commands to try to see how it works. |
The points commands won't work because it relies on a separate bot we don't have a dev version for (which we have an issue open about it - waiting on a reply from others who know more). The No rush - recover well! Health comes first. |
@MaoShizhong So while I was starting to work on the last part of this issue, I ran into a problem. I launched the bot on my server to see how the triage commands worked and there was no problem. But then I fetched upstream to sync the new commits while I was unavailable, merged them on main and my branch and the triage commands started throwing an error. I don't know if it's something I messed up in my fork or something that affected everyone. |
Played around with this locally, and I think this is being caused by you not having any people in the triage queue. Try adding yourself and then try again. (If I have time I might file a PR to handle this properly) |
Tried it and the same error shows up for every triage command - even the add command. I might just have to start over on a new fork. |
Upon further review, it seems that there is a problem with my Xubuntu. I tried starting the bot through cloning the original odin-bot repo and it still gives me the same error, while all other commands work as expected. It might be that I don't have redis on my VM, but there is a reason for that(upon installing redis my VM can't start, unless I launch my VM in recovery mode and remove redis from the VM). Since I finished modifying the rotation command but can't test it my self, should I open a PR? |
Complete the following REQUIRED checkboxes:
I have thoroughly read and understand The Odin Project Contributing Guide
The title of this issue follows the
Bug - location of bug: brief description of bug
format, e.g.Bug - points command: Extra whitespace causes command to not be called
The following checkbox is OPTIONAL:
1. Description of the Bug:
When people have special/punctuation characters in their names it causes unexpected side effects because of Discord's message formatting. For example I added "`test`" into my name and that caused the points command to show my name as "name
test
" instead of "name `test`".That can happen with other symbols as well(the 2 examples are shown in the screenshots below). The second example shows that adding || into ones name triggers the spoiler format(if there is another set of || after) which hides lines of the message in between the vertical lines.
2. How To Reproduce:
3. Expected Behavior:
4. Desktop/Device:
5. Additional Information:
The text was updated successfully, but these errors were encountered: