Skip to content

Conversation

@Kevinking500
Copy link

@Kevinking500 Kevinking500 commented Dec 15, 2025

A full module dedicated to protecting specific users/roles for future pings!
Features:

  • Sends a notice message with a GIF showing how to disable mention pings, about not being allowed to ping that user/role.
  • User is able to configure the warnings message with embed functionality, while also being able to configure the protected roles, users, ignored roles and channels and to allow/don't allow reply pings
  • User is able to configure if the bot will log ping history (default, yes and by default stored for 3 months.), if it logs moderation history (default no, as moderation capabilities is by default off. Stored for up to 12 months.) and if it keeps logs of leaved users (by default yes, by default up 1 day after leave, can be up to 7 days.)
  • User is able to configure if the bot will mute or even kick the user after they reached xx amount of pings within a timeframe. By default it is 10 pings to trigger action within the configured timeframe of pings history logging. It also has an "advanced" configuration for that to allow for a custom timeframe in weeks. The mute duration can also be adjusted to liking.

Maybe even more features that I forgot to mention here lol
This module has been extensively tested by me and my testers over a 3 day period going over every feature, including after a full code polish. Changes may look longer/shorter in duration between them because I only commit changes once tested it works.

About AI Usage:

  • I have used the following AI models:

Gemini 3 pro
Copilot

  • These have been used for the following purpose:

Auto completion (makes my life easier) (done by Copilot inside VSCode)
Some debugging
Explaining some things somewhat better (descriptions)

Kevinking500 and others added 17 commits December 11, 2025 19:46
… advanced configuration in moderation.json and made the choices inside depend on it because I forgot to :/ Added the options to enable/disable pings/modlogs/logs kept after leave and made the choices depend on it + made those choices with numbers select instead of integers for almost 0 user-error issues.
…ded into the message editor for the warning message
…o debug code, has been tested and is currently ongoing extensive testing to ensure absolutely everythig works as supposed to
…lish while remaining the same functions. Removed a few locales that are unused and updated some locales for better understanding. Fully tested extensively. Not verified by GitHub because I code in VSCode.
@CLAassistant
Copy link

CLAassistant commented Dec 15, 2025

CLA assistant check
All committers have signed the CLA.

@SCDerox SCDerox self-requested a review December 15, 2025 12:15
Listed the warnings for all commands except the panel command as the bot already checks for administrator perms.
@Kevinking500
Copy link
Author

By the way to maybe answer some questions you may have:

  • Why did I do select instead of integer in storage.json for database storage duration?

I did select with the specified minimum and maximum amount of storage time to prevent user-side configuration errors

  • Why is this not an add-on to the moderation module or ghost-ping module?

This module is supposed to have many configuration fields, options and it wouldn't make sense to put it into a module, additionally I plan to add many other features in the future which would be inlogical to be inside a module

  • Why did I not do a command warning for the panel command?

The bot already checks if the executor has administration permissions and the delete data button checks for it again, as the executor is supposed to make it not in a public channel, but sometimes they do and therefore the data deletion button checks it again

Just in case you were wondering any of the above, then you have the answers ^^
(If any of the above require a change let me know)

Copy link
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Without testing your code, I was able to identify multiple issues that need to be addressed - feel free to comment on them if you disagree.

Additionally:

  • Pings still go through, meaning that users still recive the pings "protected" by this module. This means that this module does not prevent pings, instead it punishes them. Instead of doing this, the module should create and maintain an Auto Mod Rule and react to the autoModerationActionExecution event when the rule gets triggered to run punishments.

If you have any questions, concerns or disagree with any of my comments, please reply to them directly or let me know!

Happy holidays!

@Kevinking500
Copy link
Author

Thanks for the requested changes! I will immediately work on resolving these, for ones that I have questions about I let them as a reply.

@Kevinking500
Copy link
Author

Hey Simon, I have completed the changes requested. I think most (if not all) of your changes have been done, but it's been many hours so I can't remember if I did exactly all. Please let me know if everything has been solved now!

@Kevinking500 Kevinking500 requested a review from SCDerox December 17, 2025 14:54
Copy link
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

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

  • Still not using automod APIs
  • Please mark comments that you solved as "Resolved", otherwise I am unable to review the changes.

@Kevinking500
Copy link
Author

Alright, I just reviewed all changes and I did everything except indeed the automod API which I forgot, I will be working on that now!
Though the purpose was mainly to protect the user from future pings by informing the user they are not allowed to ping. This is exactly the behaviour as other bots, and if the ping gets deleted we have to remember that there might be important context provided which we then need to enter into that message. I think it's best to be an option as I think that people also want it to let people ping in for example important situations

@SCDerox
Copy link
Member

SCDerox commented Dec 17, 2025

You could also add the automod feature as a configurable option, but I think to truly "protect" against pings, we need to actually be able to block them. This would make the module way more powerful 😄

@Kevinking500 Kevinking500 marked this pull request as ready for review December 18, 2025 17:18
@Kevinking500 Kevinking500 requested a review from SCDerox December 18, 2025 17:18
@SCDerox
Copy link
Member

SCDerox commented Dec 18, 2025

To get access to the channel, use [event].channelId (which needs to be fechted), to get access to the content, use [event].content

@Kevinking500
Copy link
Author

Ahhh okay noted. Though I removed it not only because I didn't get it to work, also because the alert message already shows the content to the protected people/people with the protected role meaning doing both a repost and sending the alert is basically double double. I have sent the full code of the bot now that works as supposed to!

…imit reached with reply pings even when it's allowed in config
@Kevinking500
Copy link
Author

Kevinking500 commented Dec 20, 2025

Hi, i've found a quite critical bug when testing extensively today for Quality Assurance.
The allow reply pings configuration option did not work properly and the bot basically ignored it.
I have fixed this, tested it and confirmed it now works the following ways when it is set to allowed:

  • The bot does not send a warning when a user replies to a protected user with mention enabled, UNLESS:

It pings a protected user/role in the actual message which is checked, then it does send a warning, logs it and punishes if necessary.

Please review the full code with soon if you haven't already ^^
(or if you are currently testing it, you can safely copy this code into messageCreate.js as it's the only file edited and only changes the logic for checking reply pings)

Kevinking500 and others added 2 commits December 28, 2025 11:09
Added from my ping protection branch
@Kevinking500
Copy link
Author

Hey, I was bored and made it that instead of sending a warning message when a protected user pings themselves, that it will send a little meme and a chance to get a secret one

Kevinking500 and others added 2 commits January 2, 2026 22:53
…for days instead of weeks in the now renamed "useCustomTimeframe" instead of "advancedConfiguration"
@Kevinking500
Copy link
Author

Hey, i've done some QOL improvements, which include all the following changes:

  • Users can now configure the now renamed to "useCustomTimeframe" instead of "advancedConfiguration" in days instead of weeks
  • The list commands have been merged (from /ping-protection list users/roles to /ping-protection list protected)
  • The protected and whitelisted embeds have gone an overhaul - They have a new name, and a fresh description explaining what they are and do. Additionally instead of roles and users being right under eachother, they are now in fields with an inline meaning it provides better oversight
  • The warning message has been updated to have a hyperlink to the list protected command (and I somehow also missed the 'command' word after 'use .....' in the previous versions)
  • The "(basic configuration)" at the end of the reason for action history has been removed, and the "(Advanced configuration)" has been renamed to "(Custom timeframe)"
  • There is now a bit more logging to provide better information, as those error logs are always silent without this.
  • Probably some more I forgot to mention

I have tested this thoroughly since yesterday to make sure every feature works and for me it works as supposed to with no bugs ^^
(Happy new year btw!)

@Kevinking500
Copy link
Author

Hi, I've made a few changes I just came up with today thst I have no idea how I missed those features earlier:

  • The configuration now also allows to whitelist specific users
  • The config now allows the users to choose of they want to instead delete all pings history of an user after the time frame instead of 1 by 1.
  • The config now also allows to choose id protected users can ping themselves or not, if they are not allowed to then they follow the usual procedure and if they are they get the chance to get rickrolled

I think that's about it ^^
Hope to hear back soon about the code :)

@Kevinking500
Copy link
Author

Whoops I accidentally made the logic opposite ways 😬, fixed it though github is annoying and made me make 2 commits for 2 files changes

Copy link
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

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

While reviewing this code, I have noticed some things, please address them 😄

As you might know, we're working on upgrading to the latest discord.js version. If you want, we can push the updated core and some modules to another branch and you can adjust your module to work with the latest version. This would allow us to accelerate your module availability on SCNX, since there's no need for us to manually upgrade it to the latest discord.js version.

Additionally, please disclose the following:

  • Please disclose whether Generative Large Language Models ("Generative AI", e.g. Coplilot) were used and to what extent to write this code. In addition, please confirm that you have reviewed and tested any generated code thoroughly. For details, please review our AI Policy.

@Kevinking500
Copy link
Author

Hey Simon, Thanks for the review!
I will address the following changes and include where and what I used AI for. Though one question about that, that should be in every file used right?
A different branch with the latest Discord.js version you are working on for the CB would be great so I can implement the new naming scheme directly and not crash the bot :)

@SCDerox
Copy link
Member

SCDerox commented Jan 9, 2026

Disclosing how AI used as a comment here is fine or you can add it to your original PR body, no need to add it into the files themselves.
Working on adding the new branch now.

@SCDerox
Copy link
Member

SCDerox commented Jan 9, 2026

The branch is now available: beta-discordjs14. Please switch the base branch of this PR to that branch.

@Kevinking500
Copy link
Author

Hey Simon, i've addressed your feedback which you can see in my ping-protection module branch. I have not yet put itto the main branch here as I am currently working on adjusting the code to DJS V14, but in the meantime if you want to you can look there but after I changed the code to DJS V14 it will show up here anyway ^^
I will also quickly update the PR description about AI usage.

@SCDerox SCDerox changed the base branch from main to beta-discordjs14 January 9, 2026 15:32
@Kevinking500
Copy link
Author

Alrighty, after alot of testing and things breaking, the Ping Protection module is finally done in Discord.JS V14, with very slight logic changes because of it (such as using .toJSON for actionRows etc because Discord.JS V14 basically requires it now)

@Kevinking500 Kevinking500 requested a review from SCDerox January 10, 2026 10:35
@Kevinking500
Copy link
Author

I've also upgraded readability for the eyes in some files that I forgot earlier, I hope that helps aswell

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.

3 participants