Skip to content

Commit

Permalink
2.6.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Scraayp committed Nov 16, 2021
1 parent fe29391 commit c74203d
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 82 deletions.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Contributing to Discord-anti-spam (DAS)
👍🎉 First off, thanks for taking the time to contribute! 🎉👍

#### Table Of Contents

[Code of Conduct](#code-of-conduct)

## How Can I Contribute?

### Reporting Bugs

This section guides you through submitting a bug report for Atom. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:.

> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
### Creating pr's

Make sure to keep it clear so that the team and see it clear what you change. You're not required to keep it short but it's recommended! Also every pr needs a review before merge by a maintainer.
91 changes: 64 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# discord-anti-spam.js

A simple module with quick setup and different options to implement anti-spam features in your bot.
**This version of the package will only support discord.js v13**

## Installation

Expand All @@ -21,37 +22,73 @@ You can see the package documentation [**here**](https://discord-anti-spam.js.or
Example of a basic bot handling spam messages using this module.

```js
const Discord = require('discord.js');
const client = new Discord.Client();
const AntiSpam = require('discord-anti-spam');
const Discord = require("discord.js");
const client = new Discord.Client({
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES],
});
const AntiSpam = require("discord-anti-spam");
const antiSpam = new AntiSpam({
warnThreshold: 3, // Amount of messages sent in a row that will cause a warning.
muteThreshold: 4, // Amount of messages sent in a row that will cause a mute
kickThreshold: 7, // Amount of messages sent in a row that will cause a kick.
banThreshold: 7, // Amount of messages sent in a row that will cause a ban.
maxInterval: 2000, // Amount of time (in milliseconds) in which messages are considered spam.
warnMessage: '{@user}, Please stop spamming.', // Message that will be sent in chat upon warning a user.
kickMessage: '**{user_tag}** has been kicked for spamming.', // Message that will be sent in chat upon kicking a user.
muteMessage: '**{user_tag}** has been muted for spamming.',// Message that will be sent in chat upon muting a user.
banMessage: '**{user_tag}** has been banned for spamming.', // Message that will be sent in chat upon banning a user.
maxDuplicatesWarning: 6, // Amount of duplicate messages that trigger a warning.
maxDuplicatesKick: 10, // Amount of duplicate messages that trigger a warning.
maxDuplicatesBan: 12, // Amount of duplicate messages that trigger a warning.
maxDuplicatesMute: 8, // Ammount of duplicate message that trigger a mute.
ignoredPermissions: [ 'ADMINISTRATOR'], // Bypass users with any of these permissions.
ignoreBots: true, // Ignore bot messages.
verbose: true, // Extended Logs from module.
ignoredMembers: [], // Array of User IDs that get ignored.
muteRoleName: "Muted", // Name of the role that will be given to muted users!
removeMessages: true // If the bot should remove all the spam messages when taking action on a user!
// And many more options... See the documentation.
warnThreshold: 3, // Amount of messages sent in a row that will cause a warning.
muteThreshold: 4, // Amount of messages sent in a row that will cause a mute
kickThreshold: 7, // Amount of messages sent in a row that will cause a kick.
banThreshold: 7, // Amount of messages sent in a row that will cause a ban.
maxInterval: 2000, // Amount of time (in milliseconds) in which messages are considered spam.
warnMessage: "{@user}, Please stop spamming.", // Message that will be sent in chat upon warning a user.
kickMessage: "**{user_tag}** has been kicked for spamming.", // Message that will be sent in chat upon kicking a user.
muteMessage: "**{user_tag}** has been muted for spamming.", // Message that will be sent in chat upon muting a user.
banMessage: "**{user_tag}** has been banned for spamming.", // Message that will be sent in chat upon banning a user.
maxDuplicatesWarning: 6, // Amount of duplicate messages that trigger a warning.
maxDuplicatesKick: 10, // Amount of duplicate messages that trigger a warning.
maxDuplicatesBan: 12, // Amount of duplicate messages that trigger a warning.
maxDuplicatesMute: 8, // Ammount of duplicate message that trigger a mute.
ignoredPermissions: ["ADMINISTRATOR"], // Bypass users with any of these permissions.
ignoreBots: true, // Ignore bot messages.
verbose: true, // Extended Logs from module.
ignoredMembers: [], // Array of User IDs that get ignored.
muteRoleName: "Muted", // Name of the role that will be given to muted users!
timeMute: 0, // Amount of time (in minutes) a user will be muted for.
removeMessages: true, // If the bot should remove all the spam messages when taking action on a user!
modLogsEnabled: false, // If to enable modlogs
modLogsChannelName: "mod-logs", // channel to send the modlogs too!
modLogsMode: "embed",
// And many more options... See the documentation.
});

client.on('ready', () => console.log(`Logged in as ${client.user.tag}.`));
client.on("ready", () => console.log(`Logged in as ${client.user.tag}.`));

client.on('message', (message) => antiSpam.message(message));
client.on("messageCreate", (message) => antiSpam.message(message));

client.login('YOUR_SUPER_SECRET_TOKEN');
client.login("YOUR_SUPER_SECRET_TOKEN");
```

## Example (As a direct copy template without explanations)

```js
const antiSpam = new AntiSpam({
warnThreshold: 3,
muteThreshold: 4,
kickThreshold: 7,
banThreshold: 7,
maxInterval: 2000,
warnMessage: "{@user}, Please stop spamming.",
kickMessage: "**{user_tag}** has been kicked for spamming.",
muteMessage: "**{user_tag}** has been muted for spamming.",
banMessage: "**{user_tag}** has been banned for spamming.",
maxDuplicatesWarning: 6,
maxDuplicatesKick: 10,
maxDuplicatesBan: 12,
maxDuplicatesMute: 8,
ignoredPermissions: ["ADMINISTRATOR"],
ignoreBots: true,
verbose: true,
ignoredMembers: [],
muteRoleName: "Muted",
muteTime: 0,
removeMessages: true,
modLogsEnabled: false,
modLogsChannelName: "mod-logs",
modLogsMode: "embed",
});
```

## Support Server
Expand All @@ -62,8 +99,8 @@ Join our [Support Server](https://discord.gg/KQgDfGr) where we help you with iss

If you have any bugs or trouble setting the module up, feel free to open an issue on [Github](https://github.com/Michael-J-Scofield/discord-anti-spam)


## 📝 License

Copyright © 2019 [Michael-J-Scofield](https://github.com/Michael-J-Scofield)<br />
This project is MIT licensed.

Expand Down
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ <h2>Installation</h2>
<h2>Documentation</h2>
<p>You can see the package documentation <a href="https://discord-anti-spam.js.org"><strong>here</strong></a>.</p>
<h2>Example</h2>
<p>Example of a basic bot handling spam messages using this module.</p>
<p>Example of a basic bot handling spam messages using this module.\n<br>The module only supports discord.js v13 and the required intents are: "GUILD_MESSAGES"</p>
<pre class="prettyprint source lang-js"><code>const Discord = require('discord.js');
const client = new Discord.Client();
const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILDS,Discord.Intents.FLAGS.GUILD_MESSAGES] });
const AntiSpam = require('discord-anti-spam');
const antiSpam = new AntiSpam({
warnThreshold: 3, // Amount of messages sent in a row that will cause a warning.
Expand All @@ -90,7 +90,7 @@ <h2>Example</h2>

client.on('ready', () => console.log(`Logged in as ${client.user.tag}.`));

client.on('message', (message) => antiSpam.message(message));
client.on('messageCreate', (message) => antiSpam.message(message));

client.login('YOUR_SUPER_SECRET_TOKEN');
</code></pre>
Expand All @@ -116,4 +116,4 @@ <h2>Bug Reports</h2>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>
</html>
2 changes: 0 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,5 @@ declare module 'discord-anti-spam' {
modLogsChannelName?: string;
modLogsEnabled?: boolean;
removeMessages?: boolean;
removeBotMessages?: boolean;
removeBotMessagesAfter?: number;
};
}
Loading

0 comments on commit c74203d

Please sign in to comment.