Skip to main content

Spam Filter

A simple and efficient spam filter built to be used in discord bots made with any fork of discord.py!

Installation

pip install git+https://github.com/DorianAarno/SpamFilter.git

Usage

Quickstart Guide

from SpamFilter import AntiSpam

@bot.event
async def on_message(msg):
  spam_check = AntiSpam().check(bot, msg.channel, msg.author)

Detailed Guide

from SpamFilter import AntiSpam

dictionary_check = True # Default is False, DO NOT USE THIS IF YOUR SERVER IS MULTI-LINGUAL, Checks if any word in the message is present in english dictionary.
timer_check = True # Default is True, Checks if a member has sent more than 5 messages within 15 seconds, if yes, 6th message is marked as spam.
content_check = True # Default is True, Checks the message's content and if a letter whose occurance in the content is highest covers more than 85% of the content, it marks the message as spam.
history_check = True # Default is True, Checks if the message's content is duplicate of the previous message.

@bot.event
async def on_message(msg):
  spam_check = AntiSpam(
    dictionary = dictionary_check,
    timer = timer_check,
    content = content_check,
    history = history_check
  ).check(bot, msg.channel, msg.author)

Example

You may view implementation of this library in PointsBot.

Notes

  • This library has only been tested with discord-disnake.
  • Your bot needs to have access to message content.

Contributing

  • Fork the repository.
  • Add your desired change or filter.
  • Open pull request.
  • Issues are welcome.
  • Consider giving this repository a ⭐, It is highly appreciated!

License

This repository has been made available via MIT License.

Metadata

Release files for discordpy-antispam 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discordpy-antispam 1.0.3
File Size Uploaded Provenance Actions
discordpy-antispam-1.0.3.tar.gz 4.1 kB Without provenance Details for discordpy-antispam-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for discordpy-antispam 1.0.3
File Interpreter ABI Platform Actions
discordpy_antispam-1.0.3-py3-none-any.whl Python 3 none any Details for discordpy_antispam-1.0.3-py3-none-any.whl

Total release size: 8.7 kB

Release files / discordpy-antispam-1.0.3.tar.gz

Download URL discordpy-antispam-1.0.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f828098ff678681f406f6ade4fb4335daebf5769966c91f8454615d60381dc17
BLAKE2b-256 checksum
How to use checksums
726614e9c4490c7bc5bccb237e71119748a898747f3a9fa15a663a4e8f17e1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / discordpy_antispam-1.0.3-py3-none-any.whl

Download URL discordpy_antispam-1.0.3-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99eb8ccf68f8dd2df39bb66287c89c5c5aba095fd9fc89ed7aa4fbd482cca595
BLAKE2b-256 checksum
How to use checksums
5688c26248691e99fb0b3ad271ab3b55305555b735d33f5bb230bb55f675de08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for discordpy-antispam 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page