Skip to content

Commit 7c1c84a

Browse files
authored
Better profanity (#203)
* profanity filter * fix profanity
1 parent 205cd02 commit 7c1c84a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ psycopg2-binary
99
yoyo-migrations
1010
ruff
1111
pre-commit
12+
better_profanity
1213

1314
# api
1415
fastapi[all] # install all to avoid random bugs

src/discord-cluster-manager/cogs/submit_cog.py

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from bot import ClusterBot
66

77
import discord
8+
from better_profanity import profanity
89
from consts import SubmissionMode
910
from discord import app_commands
1011
from discord.ext import commands
@@ -190,6 +191,14 @@ async def _validate_input_file(
190191
)
191192
return None
192193

194+
if profanity.contains_profanity(script.filename):
195+
await send_discord_message(
196+
interaction,
197+
"Please provide a non rude filename",
198+
ephemeral=True,
199+
)
200+
return None
201+
193202
# load and decode
194203
try:
195204
return (await script.read()).decode("utf-8")

0 commit comments

Comments
 (0)