Basic Anti-Nuke App
I have seen many people in the Discord server asking about an 'anti-nuke' bot in Autocode, so I built this app
Updates
• Added functionality for channel deletions
• Every 'x' minutes can be set in environment variables
• Added commenting to delete.js
and tools.js
• The app automatically checks the environment variables that are supposed to be numbers and warns you if they are not
How does it work?
It uses the built it expiry function in utils-kv to set rate limits on:
- Kicking/banning users
- Adding bots to the server
- Users joining the server
- Deleting channels
Upon reaching a limit, it will remove all the roles from the offending user that have the permissions to complete the action.
It will then send a message to the specified logs channel like this
except no. 3, where it will send a warning message to the logs channel, pinging the owner:
Note: It will not react to anything the server owner does as it cannot remove permissions anyway
Setting the environment variables
logs_channel
- The channel name where you want the bot to send anti-nuke logs. eg nuke-logs
The limit environment variables
All four of these environment variables have to be a number. eg 9
x
- The amount of minutes, as referred to in the following environment variables. It is recommended 20
user_join_limit
- The amount of users required to join in the last x minutes that triggers the bot to take action.
kick_ban_limit
- The amount of kicks/bans (by the same user) in the last x minutes that triggers the bot to take action
bot_add_limit
- The amount of bots that can be added (by the same user) in the last x minutes that triggers the bot to take action
channel_delete_limit
- The amount of channel deletions (by the same user) in the last x minutes that triggers the bot to take action
timeout_join_warning
- The timeout (in seconds) until it gives another alert (after one alert already and only if the user join limit is still over the limit)
Important: Permissions
The bot requires Administrator privileges AND has to have the highest role in order to work effectively; it may not run if this criteria is not met.
FAQ
Why is there a timeout for the next warning only on user join?
The user join would still most likely be over the limit if people are still joining, meaning the bot will send warning messages for every user that joins after meeting the limit.
So you would most likely end up with message spam and require a timeout when it next warns you.
How do I read the code?
I have included commenting on delete.js
and helpers/tools.js
to help show you how it works. The code in delete.js
is pretty much the same as add.js
and remove.js
.
Help and bugs
You can go to the Autocode Server for support
If you have found a bug, you can ping me randomguy400#7117