Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
14 changes: 9 additions & 5 deletions teapot/events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import teapot
import discord
from profanity_check import predict_prob


def __init__(bot):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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":
Expand Down