File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11aiohttp >= 3.6.2
22async-timeout >= 3.0.1
33attrs >= 19.3.0
4- beautifulsoup4 >= 4.9.1
4+ beautifulsoup4 >= 4.10.0
55bs4 >= 0.0.1
6- certifi >= 2020.6.20
6+ certifi >= 2021.5.30
77chardet >= 3.0.4
8- discord.py >= 1.7.2
8+ discord.py >= 1.7.3
99idna >= 2.10
1010lavalink >= 3.1.2
1111multidict >= 4.7.6
@@ -19,3 +19,4 @@ urllib3>=1.25.10
1919websockets >= 8.1
2020yarl >= 1.5.1
2121mysql-connector-python >= 8.0.21
22+ alt-profanity-check == 1.0
Original file line number Diff line number Diff line change 11import json
22import teapot
33import discord
4+ from profanity_check import predict_prob
45
56
67def __init__ (bot ):
@@ -48,11 +49,7 @@ def on_guild_join(bot):
4849 @bot .event
4950 async def on_guild_join (ctx ):
5051 if teapot .config .storage_type () == "mysql" :
51- try :
52- teapot .database .create_guild_table (ctx .guild )
53- except AttributeError as ignored :
54- pass
55-
52+ teapot .database .create_guild_table (ctx .guild )
5653
5754
5855def message_send (bot ):
@@ -92,6 +89,13 @@ async def on_message(message):
9289 if char not in punctuations :
9390 msg = msg + char
9491
92+ # profanity check
93+ prob = predict_prob ([msg ])
94+ if prob >= 0.8 :
95+ em = discord .Embed (title = f"AI Analysis Results" , color = 0xC54B4F )
96+ em .add_field (name = 'PROFANITY DETECTED! ' , value = str (prob [0 ]))
97+ await message .channel .send (embed = em )
98+
9599 if msg .startswith ("system call " ):
96100 content = msg [12 :].split (" " )
97101 if content [0 ].lower () == "inspect" :
You can’t perform that action at this time.
0 commit comments