Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.98 KB | None | 0 0
  1. import asyncio
  2.  
  3. from userbot import bot
  4.  
  5. from telethon import functions, types
  6.  
  7. from userbot.events import register
  8.  
  9. isAFK = False
  10. inWait = []
  11. Approved = []
  12.  
  13. @register(outgoing=True, pattern="^[.]afk$")
  14. async def setAFK(e):
  15.   global isAFK
  16.   if isAFK:
  17.     isAFK = False
  18.     await e.edit("**❌ AFK Mode Disattivata! ❌**")
  19.   else:
  20.     isAFK = True
  21.     await e.edit("**✅ AFK Mode Attivata! ✅**")
  22.  
  23. @register(outgoing=True, pattern="^[.]approve$")
  24. async def Approve(e):
  25.   global Approved
  26.   if e.is_private and not (await e.get_sender()).bot:
  27.     if e.chat_id in Approved:
  28.       await e.edit("**❌ Quest utente é già approvato ❌**")
  29.     else:
  30.       Approved.append(e.chat_id)
  31.       await e.edit("**✅ Utente Approvato ✅**")
  32.  
  33. @register(outgoing=True, pattern="^[.]disapprove$")
  34. async def Disapprove(e):
  35.   global Approved
  36.   if e.is_private and not (await e.get_sender()).bot:
  37.     if e.chat_id in Approved:
  38.       Approved.remove(e.chat_id)
  39.       await e.edit("**🚫 Utente Disapprovato 🚫**")
  40.     else:
  41.       await e.edit("**❌ Quest utente non é approvato ❌**")
  42.  
  43. @register(incoming=True)
  44. async def AFK(e):
  45.   global isAFK, Approved
  46.   if isAFK:
  47.     if e.is_private and not (await e.get_sender()).bot:
  48.       if not e.chat_id in Approved:
  49.         await e.delete()
  50.         if not e.chat_id in inWait:
  51.           await e.respond(f"⛔️ In questo momento sono offline!\n\n⚠️ Sei pregato di non inviare 400 messaggi perché tanto ho le notifiche silenziate!\n\n😘 Appena possibile ti risponderò,grazie per l'attesa!\n\n🔥Il tuo messaggio è stato salvato qui —> {e.text} \n\n- - - - - - - - - - - - - - - - - - - - -\n\n⛔️ I'm offline right now!\n\n⚠️ Please do not send 400 messages, I have silenced notifications!\n\n😘 I will answer you as soon as possible, thanks for waiting!\n\n🔥Il tuo messaggio è stato salvato qui—> {e.text}")
  52.           inWait.append(e.chat_id)
  53.           await asyncio.sleep(30)
  54.           inWait.remove(e.chat_id)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement