Skip to content
Advertisement

How can bots detect spam lines or multiple lines of useless text? [closed]

I am trying to improve my moderation side of my Discord.py bot. I would like users not to send multiple lines of spam or anything considered as “line spam”

If someone were to send a lot of lines to attempt to cause nuisance and just raid a server, how would the bot detect if the message contains too many lines?

In Discord, a simple example of spamming could be sending multiple blank lines with a . on the outsides of the blank lines

JavaScript

Is there a way to prevent this issue from happening?

Advertisement

Answer

If I understand right, you want to count lines of a given sting. so that you can use:

JavaScript

in this code ‘a’ counts the lines of attribute ‘s’ and you can limit it like :

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement