File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed 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