Improve filters
This commit is contained in:
parent
da6efccf86
commit
5509264136
30
t0sig.py
30
t0sig.py
|
@ -67,6 +67,24 @@ async def new_message(event):
|
|||
await event.reply('Entry added to t0.vc/g')
|
||||
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):
|
||||
data = dict(await request.post())
|
||||
|
@ -91,15 +109,9 @@ async def submit(request):
|
|||
if len(message) > 1000:
|
||||
raise web.HTTPBadRequest(reason='Message is too long.')
|
||||
|
||||
if 'sex' not in message and 'porn' not in message:
|
||||
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()
|
||||
messages[mid] = data
|
||||
await message_tanner(name, website, message, mid)
|
||||
|
||||
messages[mid] = data
|
||||
|
||||
with open('data/messages.log', 'a') as f:
|
||||
f.write(json.dumps(data)+'\n')
|
||||
|
|
Loading…
Reference in New Issue
Block a user