Improve filters

This commit is contained in:
Tanner Collin 2022-07-27 05:09:40 +00:00
parent da6efccf86
commit 5509264136

View File

@ -67,6 +67,24 @@ async def new_message(event):
await event.reply('Entry added to t0.vc/g') await event.reply('Entry added to t0.vc/g')
logging.info('Added: {}'.format(data)) logging.info('Added: {}'.format(data))
async def message_tanner(name, website, message, mid):
if 'sex' in message or 'porn' in message:
return
if 'lasertest' in name:
return
if 'slkjfdf.net' in website:
return
report = 'Name: {}\n\nWebsite: {}\n\nMessage: {}\n\n/allow_{}'
try:
await bot.send_message(TANNER, message=report.format(name, website, message, mid))
except:
logging.error('Problem sending bot message.')
controller_message('t0sig: problem sending bot message!')
exit()
async def submit(request): async def submit(request):
data = dict(await request.post()) data = dict(await request.post())
@ -91,15 +109,9 @@ async def submit(request):
if len(message) > 1000: if len(message) > 1000:
raise web.HTTPBadRequest(reason='Message is too long.') raise web.HTTPBadRequest(reason='Message is too long.')
if 'sex' not in message and 'porn' not in message: await message_tanner(name, website, message, mid)
report = 'Name: {}\n\nWebsite: {}\n\nMessage: {}\n\n/allow_{}'
try: messages[mid] = data
await bot.send_message(TANNER, message=report.format(name, website, message, mid))
except:
logging.error('Problem sending bot message.')
controller_message('t0sig: problem sending bot message!')
exit()
messages[mid] = data
with open('data/messages.log', 'a') as f: with open('data/messages.log', 'a') as f:
f.write(json.dumps(data)+'\n') f.write(json.dumps(data)+'\n')