Type Definitions
AntiSpamCache
Cache data for the AntiSpamClient
Properties:
Name | Type | Description |
---|---|---|
warnedUsers |
Array.<Discord.Snowflake>
|
Array of warned users. |
kickedUsers |
Array.<Discord.Snowflake>
|
Array of kicked users. |
mutedUsers |
Array.<Discord.Snowflake>
|
Array of muted users. |
bannedUsers |
Array.<Discord.Snowflake>
|
Array of banned users. |
messages |
Array.<CachedMessage>
|
Array of cached messages, used to detect spam. |
AntiSpamClientOptions
Options for the AntiSpam client
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
warnThreshold |
number
|
<optional> |
3 | Amount of messages sent in a row that will cause a warning. |
muteThreshold |
number
|
<optional> |
4 | Amount of messages sent in a row that will cause a mute. |
kickThreshold |
number
|
<optional> |
5 | Amount of messages sent in a row that will cause a kick. |
banThreshold |
number
|
<optional> |
7 | Amount of messages sent in a row that will cause a ban. |
maxInterval |
number
|
<optional> |
2000 | Amount of time (ms) in which messages are considered spam. |
maxDuplicatesInterval |
number
|
<optional> |
2000 | Amount of time (ms) in which duplicate messages are considered spam. |
maxDuplicatesWarn |
number
|
<optional> |
7 | Amount of duplicate messages that trigger a warning. |
maxDuplicatesMute |
number
|
<optional> |
9 | Amount of duplicate messages that trigger a mute. |
maxDuplicatesKick |
number
|
<optional> |
10 | Amount of duplicate messages that trigger a kick. |
maxDuplicatesBan |
number
|
<optional> |
11 | Amount of duplicate messages that trigger a ban. |
unMuteTime |
number
|
<optional> |
'0' | Time in minutes to wait until unmuting a user. |
modLogsChannel |
string
|
Discord.Snowflake
|
<optional> |
'mod-logs' | Name or ID of the channel in which moderation logs will be sent. |
modLogsEnabled |
boolean
|
<optional> |
false | Whether moderation logs are enabled. |
modLogsMode |
string
|
<optional> |
'embed' | Whether send moderations logs in an discord embed or normal message! Options: 'embed' or 'message". |
warnMessage |
string
|
<optional> |
'{@user}, Please stop spamming.' | Message that will be sent in the channel when someone is warned. |
kickMessage |
string
|
<optional> |
'**{user_tag}** has been kicked for spamming.' | Message that will be sent in the channel when someone is kicked. |
muteMessage |
string
|
<optional> |
'**{user_tag}** has been muted for spamming.' | Message that will be sent in the channel when someone is muted. |
banMessage |
string
|
<optional> |
'**{user_tag}** has been banned for spamming.' | Message that will be sent in the channel when someone is banned. |
actionInEmbed |
boolean
|
<optional> |
false | Whether the action message will be sent in an embed or not. |
actionEmbedIn |
string
|
<optional> |
"channel" | Whether the action message will be sent in the channel or dm. Options: 'channel' or 'dm'. |
actionEmbedColor |
string
|
<optional> |
'#ff0000' | Color of the embeds of the action message. |
embedFooterIconURL |
string
|
<optional> |
'https://raw.githubusercontent.com/Michael-J-Scofield/discord-anti-spam/master/docs/img/antispam.png' | Footer icon of the embed of the action message. |
embedTitleIconURL |
string
|
<optional> |
'https://raw.githubusercontent.com/Michael-J-Scofield/discord-anti-spam/master/docs/img/antispam.png' | Icon of the embeds of the action message. |
warnEmbedTitle |
string
|
<optional> |
'User has been warned' | Title of the embeds of the action message. |
kickEmbedTitle |
string
|
<optional> |
'User has been kicked' | Title of the embed of the warn message. |
muteEmbedTitle |
string
|
<optional> |
'User has been muted' | Title of the embed of the mute message. |
banEmbedTitle |
string
|
<optional> |
'User has been banned' | Title of the embed of the ban message. |
warnEmbedDescription |
string
|
<optional> |
'You have been warned for spamming.' | Description of the embed of the warn message. |
kickEmbedDescription |
string
|
<optional> |
'You have been kicked for spamming.' | Description of the embed of the kick message. |
muteEmbedDescription |
string
|
<optional> |
'You have been muted for spamming.' | Description of the embed of the mute message. |
banEmbedDescription |
string
|
<optional> |
'You have been banned for spamming.' | Description of the embed of the ban message. |
warnEmbedFooter |
string
|
<optional> |
'You have been warned.' | Footer of the embed of the warn message. |
kickEmbedFooter |
string
|
<optional> |
'You have been kicked.' | Footer of the embed of the kick message. |
muteEmbedFooter |
string
|
<optional> |
'You have been muted.' | Footer of the embed of the mute message. |
banEmbedFooter |
string
|
<optional> |
'You have been banned.' | Footer of the embed of the ban message. |
errorMessages |
boolean
|
<optional> |
true | Whether the bot should send a message in the channel when it doesn't have some required permissions, like it can't kick members. |
kickErrorMessage |
string
|
<optional> |
'Could not kick **{user_tag}** because of improper permissions.' | Message that will be sent in the channel when the bot doesn't have enough permissions to kick the member. |
banErrorMessage |
string
|
<optional> |
'Could not ban **{user_tag}** because of improper permissions.' | Message that will be sent in the channel when the bot doesn't have enough permissions to mute the member (to add the mute role). |
muteErrorMessage |
string
|
<optional> |
'Could not mute **{user_tag}** because of improper permissions.' | Message that will be sent in the channel when the bot doesn't have enough permissions to ban the member. |
ignoredMembers |
Discord.Snowflake
|
Array.<string>
|
IgnoreMemberFunction
|
<optional> |
[] | Array of member IDs that are ignored. |
ignoredRoles |
Discord.Snowflake
|
Array.<string>
|
IgnoreRoleFunction
|
<optional> |
[] | Array of role IDs or role names that are ignored. Members with one of these roles will be ignored. |
ignoredGuilds |
Discord.Snowflake
|
Array.<string>
|
IgnoreGuildFunction
|
<optional> |
[] | Array of guild IDs or guild names that are ignored. |
ignoredChannels |
Discord.Snowflake
|
Array.<string>
|
IgnoreChannelFunction
|
<optional> |
[] | Array of channel IDs or channel names that are ignored. |
ignoredPermissions |
Array.<Discord.PermissionString>
|
<optional> |
[] | Users with at least one of these permissions will be ignored. Please use the PermissionFlagsBits function. (https://discord.js.org/#/docs/discord.js/main/class/PermissionsBitField?scrollTo=s-Flags) |
ignoreBots |
boolean
|
<optional> |
true | Whether bots should be ignored. |
warnEnabled |
boolean
|
<optional> |
true | Whether warn sanction is enabled. |
kickEnabled |
boolean
|
<optional> |
true | Whether kick sanction is enabled. |
muteEnabled |
boolean
|
<optional> |
true | Whether mute sanction is enabled. |
banEnabled |
boolean
|
<optional> |
true | Whether ban sanction is enabled. |
deleteMessagesAfterBanForPastDays |
number
|
<optional> |
1 | When a user is banned, their messages sent in the last x days will be deleted. |
verbose |
boolean
|
<optional> |
true | Extended logs from module (recommended). |
debug |
boolean
|
<optional> |
false | Whether to run the module in debug mode. |
removeMessages |
boolean
|
<optional> |
true | Whether to delete user messages after a sanction. |
MultipleSanctions |
boolean
|
<optional> |
false | Whether to run sanctions multiple times |
CachedMessage
Cached message.
Properties:
Name | Type | Description |
---|---|---|
messageID |
Discord.Snowflake
|
The ID of the message. |
guildID |
Discord.Snowflake
|
The ID of the guild where the message was sent. |
authorID |
Discord.Snowflake
|
The ID of the author of the message. |
channelID |
Discord.Snowflake
|
The ID of the channel of the message. |
content |
string
|
The content of the message. |
sentTimestamp |
number
|
The timestamp the message was sent. |
IgnoreChannelFunction(channel) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
channel |
Discord.Channel
|
The channel to check |
Returns:
- Type:
-
boolean
Whether the channel should be ignored
IgnoreGuildFunction(guild) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
guild |
Discord.Guild
|
The guild to check |
Returns:
- Type:
-
boolean
Whether the guild should be ignored
IgnoreMemberFunction(member) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
member |
Discord.GuildMember
|
The member to check |
Returns:
- Type:
-
boolean
Whether the member should be ignored
IgnoreRoleFunction(role) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
role |
Discord.Collection.<Discord.Snowflake, Discord.Role>
|
The role to check |
Returns:
- Type:
-
boolean
Whether the user should be ignored