Skip to content

Feat: Ban spammers not caught by automod #699

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 193 additions & 17 deletions services/spam-ban/__snapshots__/spam-banning.service.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
exports[`Attempting to ban a bot or team member Does not ban admins 1`] = `
{
"content": "You do not have the permission to ban this user",
"ephemeral": true,
"flags": 64,
}
`;

exports[`Attempting to ban a bot or team member Does not ban bots 1`] = `
{
"content": "You do not have the permission to ban this user",
"ephemeral": true,
"flags": 64,
}
`;

exports[`Attempting to ban a bot or team member Does not ban core 1`] = `
{
"content": "You do not have the permission to ban this user",
"ephemeral": true,
"flags": 64,
}
`;

exports[`Attempting to ban a bot or team member Does not ban maintainers 1`] = `
{
"content": "You do not have the permission to ban this user",
"ephemeral": true,
"flags": 64,
}
`;

exports[`Attempting to ban a bot or team member Does not ban moderators 1`] = `
{
"content": "You do not have the permission to ban this user",
"ephemeral": true,
"flags": 64,
}
`;

Expand Down Expand Up @@ -70,37 +70,211 @@ exports[`Attempting to log banned user in moderation log channel Sends log to th
}
`;

exports[`Banning spammer in different channels Ban user if in the automod channel 1`] = `
exports[`Banning spammer in automod channel Ban user if in the automod channel 1`] = `
{
"deleteMessageSeconds": 0,
"reason": "Account is compromised",
}
`;

exports[`Banning spammer in different channels Ban user if in the automod channel 2`] = `
exports[`Banning spammer in automod channel Ban user if in the automod channel 2`] = `
{
"content": "Successfully banned <@123> for spam.",
"flags": 64,
}
`;

exports[`Banning spammer in other channels Asks for confirmation if not in automod channel 1`] = `
{
"components": [
{
"components": [
{
"custom_id": "keepMessages",
"emoji": undefined,
"label": "Don't delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "deleteMessages",
"emoji": undefined,
"label": "Delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "cancel",
"emoji": undefined,
"label": "Cancel",
"style": 2,
"type": 2,
},
],
"type": 1,
},
],
"content": "Would you like to delete messages from the user being banned?",
"ephemeral": true,
"withResponse": true,
}
`;

exports[`Banning spammer in other channels Bans user and deletes their messages if delete message button clicked 1`] = `
{
"deleteMessageSeconds": 604800,
"reason": "Account is compromised",
}
`;

exports[`Banning spammer in other channels Bans user and deletes their messages if delete message button clicked 2`] = `
{
"components": [
{
"components": [
{
"custom_id": "keepMessages",
"emoji": undefined,
"label": "Don't delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "deleteMessages",
"emoji": undefined,
"label": "Delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "cancel",
"emoji": undefined,
"label": "Cancel",
"style": 2,
"type": 2,
},
],
"type": 1,
},
],
"content": "Would you like to delete messages from the user being banned?",
"ephemeral": true,
"withResponse": true,
}
`;

exports[`Banning spammer in different channels Does not ban user in different channels other than automod 1`] = `
exports[`Banning spammer in other channels Bans user and does not delete their messages if keep message button clicked 1`] = `
{
"content": "This command can only be used in the automod block channel.",
"deleteMessageSeconds": 0,
"reason": "Account is compromised",
}
`;

exports[`Banning spammer in other channels Bans user and does not delete their messages if keep message button clicked 2`] = `
{
"components": [
{
"components": [
{
"custom_id": "keepMessages",
"emoji": undefined,
"label": "Don't delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "deleteMessages",
"emoji": undefined,
"label": "Delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "cancel",
"emoji": undefined,
"label": "Cancel",
"style": 2,
"type": 2,
},
],
"type": 1,
},
],
"content": "Would you like to delete messages from the user being banned?",
"ephemeral": true,
"withResponse": true,
}
`;

exports[`Banning spammer in different channels Does not ban user in different channels other than automod 2`] = `
exports[`Banning spammer in other channels Cancels the action if the cancel button is clicked 1`] = `
{
"content": "This command can only be used in the automod block channel.",
"components": [
{
"components": [
{
"custom_id": "keepMessages",
"emoji": undefined,
"label": "Don't delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "deleteMessages",
"emoji": undefined,
"label": "Delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "cancel",
"emoji": undefined,
"label": "Cancel",
"style": 2,
"type": 2,
},
],
"type": 1,
},
],
"content": "Would you like to delete messages from the user being banned?",
"ephemeral": true,
"withResponse": true,
}
`;

exports[`Banning spammer in different channels Does not ban user in different channels other than automod 3`] = `
exports[`Banning spammer in other channels Cancels the action if the response times out 1`] = `
{
"content": "This command can only be used in the automod block channel.",
"components": [
{
"components": [
{
"custom_id": "keepMessages",
"emoji": undefined,
"label": "Don't delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "deleteMessages",
"emoji": undefined,
"label": "Delete messages",
"style": 4,
"type": 2,
},
{
"custom_id": "cancel",
"emoji": undefined,
"label": "Cancel",
"style": 2,
"type": 2,
},
],
"type": 1,
},
],
"content": "Would you like to delete messages from the user being banned?",
"ephemeral": true,
"withResponse": true,
}
`;

Expand All @@ -109,12 +283,13 @@ exports[`Banning spammer that has left the server Reacts with the correct emoji
exports[`Banning spammer that has left the server Sends back correct interaction reply to calling moderator 1`] = `
{
"content": "Banned <@123> for spam but wasn't able to contact the user as they have left the server.",
"ephemeral": true,
"flags": 64,
}
`;

exports[`Banning spammer who has DM set to private Discord ban api is called with the correct reason 1`] = `
{
"deleteMessageSeconds": 0,
"reason": "Account is compromised",
}
`;
Expand All @@ -124,7 +299,7 @@ exports[`Banning spammer who has DM set to private Reacts with the correct emoji
exports[`Banning spammer who has DM set to private Sends back correct interaction reply to calling moderator 1`] = `
{
"content": "Banned <@123> for spam but wasn't able to contact the user.",
"ephemeral": true,
"flags": 64,
}
`;

Expand Down Expand Up @@ -165,14 +340,15 @@ exports[`Banning spammer who has DM set to private Sends log to the correct chan

exports[`Banning spammer with DM enabled Discord ban api is called with the correct reason 1`] = `
{
"deleteMessageSeconds": 0,
"reason": "Account is compromised",
}
`;

exports[`Banning spammer with DM enabled Discord ban api is called with the correct reason 2`] = `
{
"content": "Successfully banned <@123> for spam.",
"ephemeral": true,
"flags": 64,
}
`;

Expand Down Expand Up @@ -203,7 +379,7 @@ exports[`Banning spammer with DM enabled Reacts with the correct emoji 1`] = `"
exports[`Banning spammer with DM enabled Sends back correct interaction reply to calling moderator 1`] = `
{
"content": "Successfully banned <@123> for spam.",
"ephemeral": true,
"flags": 64,
}
`;

Expand Down
Loading