Refactor Karma and Thanks to simplify and avoid exploits#325
Conversation
Formats message differently, avoids a karma farming exploit. May refactor again to just use the string extension ToCommaList, and simplify the disallowed mentions logic.
🚀 Deploy this PR to an environmentYou can deploy this PR to either development or staging environment:
Alternatively, you can:
|
|
Here's the code health analysis summary for commits Analysis Summary
|
|
/deploy_dev |
|
🚀 Starting deployment of |
|
/deploy_dev |
|
🚀 Starting deployment of |
|
/deploy_dev |
|
🚀 Starting deployment of |
|
/deploy_dev |
|
🚀 Starting deployment of |
|
/deploy_dev |
|
🚀 Starting deployment of |
There was a problem hiding this comment.
Pull Request Overview
Refactors Karma and Thanks logic to simplify error handling, prevent edge-case exploits, and streamline message formatting using new string extensions.
- Removed unused exception variable declarations in
WebUtil - Enhanced the thanks regex to skip “no thanks” phrases and filter out bots/self mentions
- Introduced
ToBoldextensions and ensured awaited deletions in moderation commands
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| DiscordBot/Utils/WebUtil.cs | Swallowed exceptions by dropping variable names in catch blocks |
| DiscordBot/Settings/Deserialized/Settings.cs | Added TipsUserRoleId and TipsAuthorRoleId settings |
| DiscordBot/Services/UserService.cs | Updated thanks regex, filtered mentions, refactored DB updates |
| DiscordBot/Modules/ModerationModule.cs | Added await to asynchronous delete calls |
| DiscordBot/Extensions/StringExtensions.cs | Added ToBold and ToBoldArray extension methods |
|
/deploy_dev |
|
🚀 Starting deployment of |
5e124ce
into
Unity-Developer-Community:master
Found a couple small exploits/edgecases and overly complex code in the Thanks patterns and Karma credit code. Also using some of the previously added phrase-list grammar extensions.