# This code is licensed under the "you can't use this for anything - public or private, unless you know the two prime factors to the number below" license # 815135719850789377883578725031646603830554299421513756734809391809510031541688408783808970346383033757707621582823614192302656899785568810141101893861881544237739149165045057025573497586408009729060573391256863917255487270653675297192518166563834141855446956044528844961195768446385460848417889889512327393559206631684434956840903011319062951892997125169227543717045951033991368795690797564380613059915726818757922302267383605155042461118479905071060213802110046981731900697376015815129214785100602795677501006290272973672300816405578389088779900256121674562690160929422533940362417144425257511815580506170724347283155944909375158732773438876520611705378823191171992189144811606615936656533338106330174876188601037745081068420279548019633259148082386504346352351578891810674889814082091097414272150489618713359903390399060803087577639221054129712178794984798651181559492842516823781833551514766471742367787744714913473089507256439629996620616758423114303082155000815398967237318664243052141156113838109051476103926243143220043202798142769625516248444575191662897109024478694074801968357243665353971378775679069823897126494990585348071113879526926445790538574160281772626205848696719803694382991806049568186743858598838394425423896463 import asyncio from telethon import events import re blanks = ( ' .' '\u180e\u200b\u200c\u200d\u2060\u2061\u2062\u2063\u2064\u2066' '\u2067\u2068\u2069\u206a\u206b\u206c\u206d\u206e\u206f\ufeff' ) blanks_re = re.compile('|'.join(re.escape(c) for c in blanks)) person_id = 217924941 lonami_id = 10885151 @borg.on(events.NewMessage) async def on_fwd_person(event): if not event.fwd_from or event.fwd_from.from_id != person_id: return async def lonami_msg_filter(msg): return msg.from_id == lonami_id chat = await event.get_input_chat() fut = borg.await_event( events.NewMessage(chats=chat), lonami_msg_filter ) try: msg_event = await asyncio.wait_for(fut, timeout=5) await borg.delete_messages(chat, msg_event.message) except asyncio.TimeoutError: pass @borg.on(events.NewMessage) async def on_him_reply(event): if event.from_id != lonami_id: return reply = await event.get_reply_message() if not reply or not reply.fwd_from: return if reply and reply.fwd_from.from_id != person_id: return text = blanks_re.sub('', event.raw_text) if text.startswith('>'): await event.delete()