feat: moderation tool migration into webdev-bot - #85
Conversation
…es to match use cases
This has several changes in one commit. Notably: - The spam detection feature has been migrated, the spam detection feature had several imports relinked to their respective webdev-bot/ counterparts - Several tests have been syntactically modified to meet the requirements of the new oxclint tool. - The (now) two caches were migrated into util/cache and their names were adapted to reflect of their exact usage. - The MAX_RULE_TIMEFRAME constant was updated to refer to the correct function instead of the placeholder. It may currently break convention by importing from the features/. - Currently 2 tests fail, one from the advent calendar and one from the newly migrated spam-detection feature. Will follow up in next commit.
a stray console log led me to think the migration broke tests
|
Draft means it is not ready for review. Make it ready for review if you want a review. |
Also, change the convention on this feature to match that of webdev-bot/
Sorry about that, I'm still learning the conventions of PR's so I will note this for the future. I've finished the implementation, and I hope I met your expectations. If not, I will happily take your critical assessment and revise the code. Thanks for your help! |
Co-authored-by: Cake <letsmailali.h@gmail.com>
Co-authored-by: Cake <letsmailali.h@gmail.com>
Co-authored-by: Cake <letsmailali.h@gmail.com>
4769ad7 to
13fc65d
Compare
There was a problem hiding this comment.
the comments prefixed "create issue" don't require any action, those were for me so i know where i need to followup on. i will resolve them after i create the issues for them.
anything else is directed to you. we will have to test this branch in the testing server as well.
| const options = { | ||
| rule: { | ||
| type: 'contentBased', | ||
| isBrokenBy: () => true, | ||
| action: async () => {}, | ||
| }, | ||
| messages: [ | ||
| { | ||
| content: 'This message contains a banned tag', | ||
| channelId: '123', | ||
| author: { id: '1' }, | ||
| }, | ||
| ] as Message[], | ||
| deletedMessagesCount: 1, | ||
| reason: 'Contains banned tag', | ||
| muteDuration: 1 * HOUR, | ||
| } satisfies LogFunctionOptions<ContentBasedRule>; |
There was a problem hiding this comment.
move options to above the describe.
| } satisfies LogFunctionOptions<ContentBasedRule>; | ||
|
|
||
| const logContent = createLogTextContent(options); | ||
| // console.log(logContent); |
| const logContent = createLogTextContent(options); | ||
| // console.log(logContent); | ||
|
|
||
| // Basic assertions to check if the log content includes expected information |
| jaccardSimilarity, | ||
| } from './messages.js'; | ||
|
|
||
| void describe('utils/messages -> stripCode', () => { |
There was a problem hiding this comment.
i don't know how it was in the moderation bot repo from the top of my head, but
describe("<file-name>", () => {
describe("<function-name>", () => {
// it-cases unit tests for the function
})
}) create tests like so. where we have one top describe for the file it is testing, and then inside of that we have more describe for the function specific, which then holds all the it cases of that function.
Moderation Tool Migration
Overview
This is a PR migrating the spam detection and moderation system for the webdev-bot from the moderation-tool bot, addressing the issue found here: #80
What I Did
SPAM_DETECTION_CHANNEL_IDto all environment filesStatus:
DONE - Ready for review and feedback before finalization.
Made with ❤️, written by hand