Filter useless messages

This commit is contained in:
Tanner Collin 2025-05-06 18:07:09 +00:00
parent ce26621119
commit e677b6dff8

28
main.py
View File

@ -132,6 +132,26 @@ async def get_messages():
return messages
async def bot_send(destination, message):
silent = False
if 'tristen' and 'cardinal' in message.lower():
logging.info('Tristen Cardinal spam, skipping.')
return
if '@Y@o@u@' in message:
logging.info('Voice mail alert, muting.')
silent = True
if '@M@e@s@s@a@g@e@' in message:
logging.info('Voice mail alert, muting.')
silent = True
tg = await bot.send_message(destination, message, link_preview=False, silent=silent)
logging.info('Sent TG bot message %s', tg.id)
async def check_messages():
messages = await get_messages()
@ -147,9 +167,7 @@ async def check_messages():
message['text'],
)
tg = await bot.send_message(settings.TANNER_ID, bot_message, link_preview=False)
logging.info('Sent TG bot message %s', tg.id)
await bot_send(settings.TANNER_ID, bot_message)
await delete_message(message['mid'])
@ -182,7 +200,7 @@ async def send(event):
if res:
await event.reply('ok')
else:
await event.reply('Error sending SMS.')
await event.reply('Error sending SMS. Not allowed special characters?')
@bot.on(events.NewMessage(pattern='^(?!\/).*$'))
async def new_message(event):
@ -212,7 +230,7 @@ async def new_message(event):
res = await send_message(from_field, event.raw_text)
if not res:
await event.reply('Error sending SMS.')
await event.reply('Error sending SMS. Not allowed special characters?')
async def main():