Spam Module

Tracks all channels it is active on for spammers. Each message someone sends generates "pressure", which decays rapidly. Long messages, messages with links, or messages with pings will generate more pressure. If a user generates too much pressure, they will be silenced and the moderators notified. Also detects groups of people joining at the same time and alerts the moderators of a potential raid.

To force this module to ignore a specific channel, use this command: !setconfig modules.channels spam ! #channelname. If the bot is silencing everyone, you should re-run !setup OVERRIDE to reset the spam configuration. If you want to have a containment channel where silenced members can talk, use !setconfig welcomechannel #channelname.

IF THE BOT IS OVERWHELMED BY A RAID, FOLLOW THESE INSTRUCTIONS CAREFULLY: Due to rate limits, the bot can be overwhelmed by spammers using hundreds of different accounts. As a last resort, you can tell the bot to ban everyone who has sent their first message in the past 3 minutes by running this command: !bannewcomers. Only use this as a last resort, as it can easily ban people who joined and were caught up in the raid.

Configuration

spam.basepressure

The base pressure generated by sending a message, regardless of length or content. Defaults to 10

spam.ignorerole

If set, the bot will exclude anyone with this role from spam detection. Use with caution. Does NOT prevent people from sending the bot commands.

spam.imagepressure

Additional pressure generated by each image, link or attachment in a message. Defaults to (MaxPressure - BasePressure) / 6 = 8.3, instantly silencing anyone posting 6 or more links at once.

spam.lengthpressure

Additional pressure generated by each individual character in the message. Discord allows messages up to 2000 characters in length. Defaults to (MaxPressure - BasePressure) / 8000 = 0.00625, silencing anyone posting 3 huge messages at the same time.

spam.linepressure

Additional pressure generated by each newline in the message. Defaults to (MaxPressure - BasePressure) / 70 = 0.714, silencing anyone posting more than 70 newlines in a single message

spam.lockdownduration

Determines how long the server's verification mode will temporarily be increased to tableflip levels after a raid is detected. If set to 0, disables lockdown entirely.

spam.maxchannelpressure

Per-channel pressure override. If a channel's pressure is specified in this map, it will override the global maxpressure setting.

spam.maxpressure

The maximum pressure allowed. If a user's pressure exceeds this amount, they will be silenced. Defaults to 60, which is intended to ban after a maximum of 6 short messages sent in rapid succession.

spam.maxremovelookback

Number of seconds back the bot should delete messages of a silenced user on the channel they spammed on. If set to 0, the bot will only delete the message that caused the user to be silenced. If less than 0, the bot won't delete any messages.

spam.pingpressure

Additional pressure generated by each unique ping in a message. Defaults to (MaxPressure - BasePressure) / 20 = 2.5, instantly silencing anyone pinging 20 or more people at once.

spam.pressuredecay

The number of seconds it takes for a user to lose Spam.BasePressure from their pressure amount. Defaults to 2.5, so after sending 3 messages, it will take 7.5 seconds for their pressure to return to 0.

spam.raidsilence

Gets the current raidsilence state. Use the !RaidSilence command to set this.

spam.raidsize

Specifies how many people must have joined the server within the spam.raidtime period to qualify as a raid.

spam.raidtime

In order to trigger a raid alarm, at least spam.raidsize people must join the chat within this many seconds of each other.

spam.repeatpressure

Additional pressure generated by a message that is identical to the previous message sent (ignores case). Defaults to BasePressure, effectively doubling the pressure penalty for repeated messages.

spam.silencetimeout

If greater than 0, any members silenced by the bot (not by the !silence command) will be automatically unsilenced after this many seconds. This includes anyone silenced during a raid.

RaidSilence

!raidsilence <all/raid/off>

Toggles silencing new members during raids. This does not affect spam detection, only new members joining the server.

all/raid/off

all will always silence all new members. raid will only silence new members if a raid is detected, up to spam.raidtime*2 seconds after the raid is detected. off disables raid silencing.

Wipe

!wipe [channel] <seconds/messages>

Removes all messages in a channel sent within the last N seconds, or remove the last N messages if 'm' is appended to the number. Examples:

!wipe 23m
!wipe #channel 10

channel

(optional) The channel to delete from. You must use the #channel format so discord actually highlights the channel, otherwise it won't work. If omitted, uses the current channel

seconds/messages

Specifies the number of seconds to look back. The command deletes all messages sent up to this many seconds ago. If you append 'm' to this number, it will instead delete exactly that many messages.

GetPressure

!getpressure <user>

Gets the current spam pressure of a user.

user

User to retrieve pressure from.

GetRaid

!getraid

Lists all users that are considered part of the most recent raid, if there was one.

BanRaid

!banraid

Bans all users that are considered part of the most recent raid, if there was one. Use !getraid to check who will be banned before using this command.