diff --git a/requirements.txt b/requirements.txt index f8f10a9..b3caa4e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ aiohttp>=3.6.2 async-timeout>=3.0.1 attrs>=19.3.0 -beautifulsoup4>=4.9.1 +beautifulsoup4>=4.10.0 bs4>=0.0.1 -certifi>=2020.6.20 +certifi>=2021.5.30 chardet>=3.0.4 -discord.py>=1.7.2 +discord.py>=1.7.3 idna>=2.10 lavalink>=3.1.2 multidict>=4.7.6 @@ -19,3 +19,4 @@ urllib3>=1.25.10 websockets>=8.1 yarl>=1.5.1 mysql-connector-python>=8.0.21 +alt-profanity-check==1.0 \ No newline at end of file diff --git a/teapot/events.py b/teapot/events.py index 8329a9a..58207b2 100644 --- a/teapot/events.py +++ b/teapot/events.py @@ -1,6 +1,7 @@ import json import teapot import discord +from profanity_check import predict_prob def __init__(bot): @@ -48,11 +49,7 @@ def on_guild_join(bot): @bot.event async def on_guild_join(ctx): if teapot.config.storage_type() == "mysql": - try: - teapot.database.create_guild_table(ctx.guild) - except AttributeError as ignored: - pass - + teapot.database.create_guild_table(ctx.guild) def message_send(bot): @@ -92,6 +89,13 @@ async def on_message(message): if char not in punctuations: msg = msg + char + # profanity check + prob = predict_prob([msg]) + if prob >= 0.8: + em = discord.Embed(title=f"AI Analysis Results", color=0xC54B4F) + em.add_field(name='PROFANITY DETECTED! ', value=str(prob[0])) + await message.channel.send(embed=em) + if msg.startswith("system call "): content = msg[12:].split(" ") if content[0].lower() == "inspect":