SHARE
TWEET

Untitled

a guest Feb 14th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import telethon
  2. from telethon import TelegramClient, events
  3. from time import sleep as ts
  4. import logging
  5. import asyncio
  6. import re
  7. from core.foxlite import *
  8. from telethon.tl.functions.account import UpdateProfileRequest
  9. logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
  10.                     level=logging.WARNING)
  11. from googletrans import Translator
  12.  
  13.  
  14.  
  15. api_id =
  16. api_hash = ''
  17. client = TelegramClient('test', api_id, api_hash)
  18. client.parse_mode=None
  19.  
  20. @client.on(events.NewMessage)
  21. async def my_event_handler(event):
  22.     if event.chat_id==-1001200413132:
  23.         mats=db.select("SELECT * FROM `words`")
  24.         lis=mats[1].lower().split()
  25.         text = event.raw_text.lower()
  26.         for bad_word in lis:
  27.             text=re.sub(f'(?i)\\b{bad_word}\\b', '*' * len(bad_word), text)
  28.         if text != event.raw_text.lower():
  29.             await event.delete()
  30.             await client.send_message(event.chat_id, text)
  31.         print(event.raw_text+"\n")
  32.        
  33.  
  34. client.start()
  35. client.run_until_disconnected()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top