async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply("Lagi AFK bentar." f"\nKarna lagi `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply("Lagi AFK ntar juga ada lagi." f"\nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ global ISAFK global USERS global COUNT_MSG if (sender.is_private and sender.sender_id != 777000 and not (await sender.get_sender()).bot): if PM_AUTO_BAN: try: from userbot.modules.sql_helper.pm_permit_sql import \ is_approved apprv = is_approved(sender.sender_id) except AttributeError: apprv = True else: apprv = True if apprv and ISAFK: if sender.sender_id not in USERS: if AFKREASON: await sender.reply(f"I'm AFK right now.\ \nReason: `{AFKREASON}`") else: await sender.reply(str(choice(AFKSTR))) USERS.update({sender.sender_id: 1}) else: if USERS[sender.sender_id] % randint(2, 4) == 0: if AFKREASON: await sender.reply(f"I'm still AFK.\ \nReason: `{AFKREASON}`") else: await sender.reply(str(choice(AFKSTR))) USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(afk_pm): global USERS global COUNT_MSG if not is_redis_alive(): return IsAway = await is_afk() if afk_pm.is_private and not (await afk_pm.get_sender()).bot: if IsAway is True: if afk_pm.sender_id not in USERS: await afk_pm.reply( "Sorry! My master is AFK due to ```" + await afk_reason() + "``` I'll ping him to look into the message soon😉") USERS.update({afk_pm.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif afk_pm.sender_id in USERS: if USERS[afk_pm.sender_id] % 5 == 0: await afk_pm.reply( "Sorry! But my master is still not here. " "Try to ping him a little later. I am sorry😖." "He told me he was busy with ```" + await afk_reason() + "```") USERS[afk_pm.sender_id] = USERS[afk_pm.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[afk_pm.sender_id] = USERS[afk_pm.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK global USER_AFK # pylint:disable=E0602 global afk_time # pylint:disable=E0602 global afk_start global afk_end back_alivee = datetime.now() afk_end = back_alivee.replace(microsecond=0) afk_since = "a while ago" if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: now = datetime.now() datime_since_afk = now - afk_time # pylint:disable=E0602 time = float(datime_since_afk.seconds) days = time // (24 * 3600) time = time % (24 * 3600) hours = time // 3600 time %= 3600 minutes = time // 60 time %= 60 seconds = time if days == 1: afk_since = "Yesterday" elif days > 1: if days > 6: date = now + datetime.timedelta( days=-days, hours=-hours, minutes=-minutes) afk_since = date.strftime("%A, %Y %B %m, %H:%I") else: wday = now + datetime.timedelta(days=-days) afk_since = wday.strftime("%A") elif hours > 1: afk_since = f"`{int(hours)}h{int(minutes)}m` ago" elif minutes > 0: afk_since = f"`{int(minutes)}m{int(seconds)}s` ago" else: afk_since = f"`{int(seconds)}s` ago" if mention.sender_id not in USERS: if AFKREASON: await mention.reply(f"I'm AFK since {afk_since}.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"I'm still AFK since {afk_since}.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK global afk_time global afk_start global afk_end not_afk = datetime.now() afk_end = not_afk.replace(microsecond=0) if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: now = datetime.now() afk_since = now - afk_time day = float(afk_since.seconds) // (24 * 3600) time = float(afk_since.seconds) % (24 * 3600) hours = time // 3600 time %= 3600 minutes = time // 60 time %= 60 seconds = time if day == 1: afk_str = "Yesterday" elif day > 1: if day > 6: date = now + \ datetime.timedelta( days=-day, hours=-hours, minutes=-minutes) afk_str = date.strftime("%A, %Y %B %m, %H:%I") else: wday = now + datetime.timedelta(days=-day) afk_str = wday.strftime('%A') elif hours > 1: afk_str = f"`{int(hours)}h{int(minutes)}m` ago" elif minutes > 0: afk_str = f"`{int(minutes)}m{int(seconds)}s` ago" else: afk_str = f"`{int(seconds)}s` ago" if mention.sender_id not in USERS: if AFKREASON: await mention.reply("I'm AFK right now." f"\nBecause I'm `{AFKREASON}`." f"\nAFK since: {afk_str}") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply("I'm still AFK." f"\nReason: `{AFKREASON}`." f"\nAFK from: {afk_str}") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: await mention.reply( f"Oye bsdk, My boss is AFK due to `{AFKREASON}`." "\nDon't Disturb else Rape." ) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 5 == 0: await mention.reply( "U Bsdk gey,But my boss is still not here." "\nTry to ping him a little later.Ab Nikal 😖." f"\nHe told me he was busy with `{AFKREASON}`." ) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ Bu fonksiyon biri sizi etiketlediğinde sizin AFK olduğunuzu bildirmeye yarar.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: if type(PLUGIN_MESAJLAR['afk']) is str: await mention.reply(f"{PLUGIN_MESAJLAR['afk']}\ \nSebep: `{AFKREASON}`") else: msj = await mention.reply(PLUGIN_MESAJLAR['afk']) await msj.reply(f"Sebep: `{AFKREASON}`") else: await mention.reply(PLUGIN_MESAJLAR['afk']) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: if PLUGIN_MESAJLAR['afk'] is str: await mention.reply(f"{PLUGIN_MESAJLAR['afk']}\ \nSebep: `{AFKREASON}`") else: msj = await mention.reply(PLUGIN_MESAJLAR['afk']) await msj.reply(f"Sebep: `{AFKREASON}`") else: await mention.reply(PLUGIN_MESAJLAR['afk']) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply( f"Maaf sob 🙏, lagi pindah alam karena `{AFKREASON}`. Saya akan melihat pesan kalian setelah saya kembali 😉." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 2 == 0: if AFKREASON: await mention.reply( f"Maaf, saya masih ada di dunia yang lain, terlalu sibuk dengan `{AFKREASON}`." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS if not is_redis_alive(): return AFK = await is_afk() if mention.message.mentioned and not (await mention.get_sender()).bot: if AFK is True: if mention.sender_id not in USERS: await mention.reply( "𝙎𝙘𝙪𝙨𝙖! 𝙈𝙖 ᴀꜱʜ è 𝘼𝙁𝙆 𝙥𝙚𝙧: " + await afk_reason() + ". 𝙂𝙡𝙞 𝙢𝙖𝙣𝙙𝙚𝙧ò 𝙪𝙣𝙖 𝙣𝙤𝙩𝙞𝙛𝙞𝙘𝙖 𝙥𝙚𝙧 𝙛𝙖𝙧 𝙫𝙚𝙙𝙚𝙧𝙚 𝙞𝙡 𝙩𝙪𝙤 𝙢𝙚𝙨𝙨𝙖𝙜𝙜𝙞𝙤😉." ) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 5 == 0: await mention.reply( "𝙎𝙘𝙪𝙨𝙖! 𝙈𝙖 ᴀꜱʜ 𝙣𝙤𝙣 è 𝙖𝙣𝙘𝙤𝙧𝙖 𝙩𝙤𝙧𝙣𝙖𝙩𝙤. " "𝙋𝙧𝙤𝙫𝙖 𝙖 𝙞𝙣𝙫𝙞𝙖𝙧𝙜𝙡𝙞 𝙪𝙣 𝙢𝙚𝙨𝙨𝙖𝙜𝙜𝙞𝙤 𝙩𝙧𝙖 𝙪𝙣 𝙥𝙤'. 𝙈𝙞 𝙙𝙞𝙨𝙥𝙞𝙖𝙘𝙚😖." "𝙈𝙞 𝙝𝙖 𝙙𝙚𝙩𝙩𝙤 𝙘𝙝𝙚 𝙚𝙧𝙖 𝙞𝙢𝙥𝙚𝙜𝙣𝙖𝙩𝙤 𝙥𝙚𝙧: ```" + await afk_reason() + "```") USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" if environ.get("isSuspended") == "True": return global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply(f"I'm AFK right now.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"I'm still AFK.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ if environ.get("isSuspended") == "True": return global ISAFK global USERS global COUNT_MSG if sender.is_private and sender.sender_id != 777000 and not ( await sender.get_sender()).bot: if ISAFK: if sender.sender_id not in USERS: if AFKREASON: await sender.reply(f"I'm AFK right now.\ \nReason: `{AFKREASON}`") else: await sender.reply(str(choice(AFKSTR))) USERS.update({sender.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif sender.sender_id in USERS: if USERS[sender.sender_id] % randint(2, 4) == 0: if AFKREASON: await sender.reply(f"I'm still AFK.\ \nReason: `{AFKREASON}`") else: await sender.reply(str(choice(AFKSTR))) USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply(f"Aeng AEPKA.\ \nReason I'm `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"AEPKA Keneh..Kalem.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ global ISAFK global USERS global COUNT_MSG if sender.is_private and not (await sender.get_sender()).bot: if ISAFK: if sender.sender_id not in USERS: await sender.reply( f"Bsdk, My God and Your Dad Is AFK Due to `{AFKREASON}`." "\nI'Mere Baghwaan Dekh Lenge Tera Message Bhi Rot Mt bosdike!! Dubara Tag Mat Kriyo Gey 😉." ) USERS.update({sender.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif sender.sender_id in USERS: if USERS[sender.sender_id] % 5 == 0: await sender.reply( "Bitch,But my boss is still not here." "\nTry to ping him a little later. I am sorry 😖." f"\nHe told me he was busy with `{AFKREASON}`.") USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: await mention.reply( f"Sorry! Mere boss `{gaye hai chodne}`." "\nto unhe santi se chodne de warna wo aapko chod denge! 😉." ) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 5 == 0: await mention.reply( "Sorry! But my boss is still not here." "\nTry to ping him a little later. I am sorry 😖." f"\nHe told me he was busy with `{AFKREASON}`.") USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ Bu fonksiyon biri sizi etiketlediğinde sizin AFK olduğunuzu bildirmeye yarar.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply(f"Kullanıcım çevrimdışı.\ \nSebep: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"Kullanıcım çevrimdışı.\ \nSebep: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(e): global USERS global COUNT_MSG if not is_redis_alive(): return AFK = await is_afk() if e.is_private and not (await e.get_sender()).bot: if AFK is True: if e.sender_id not in USERS: await e.reply( "𝙎𝙘𝙪𝙨𝙖! 𝙈𝙖 ᴀꜱʜ è 𝘼𝙁𝙆 𝙥𝙚𝙧:```" + await afk_reason() + "```. 𝙂𝙡𝙞 𝙢𝙖𝙣𝙙𝙚𝙧ò 𝙪𝙣𝙖 𝙣𝙤𝙩𝙞𝙛𝙞𝙘𝙖 𝙥𝙚𝙧 𝙛𝙖𝙧 𝙫𝙚𝙙𝙚𝙧𝙚 𝙞𝙡 𝙩𝙪𝙤 𝙢𝙚𝙨𝙨𝙖𝙜𝙜𝙞𝙤😉" ) USERS.update({e.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif e.sender_id in USERS: if USERS[e.sender_id] % 5 == 0: await e.reply( "𝙎𝙘𝙪𝙨𝙖! 𝙈𝙖 ᴀꜱʜ 𝙣𝙤𝙣 è 𝙖𝙣𝙘𝙤𝙧𝙖 𝙩𝙤𝙧𝙣𝙖𝙩𝙤!. " "𝙋𝙧𝙤𝙫𝙖 𝙖 𝙞𝙣𝙫𝙞𝙖𝙧𝙜𝙡𝙞 𝙪𝙣 𝙢𝙚𝙨𝙨𝙖𝙜𝙜𝙞𝙤 𝙩𝙧𝙖 𝙪𝙣 𝙥𝙤'. 𝙈𝙞 𝙙𝙞𝙨𝙥𝙞𝙖𝙘𝙚😖." "𝙈𝙞 𝙝𝙖 𝙙𝙚𝙩𝙩𝙤 𝙘𝙝𝙚 𝙚𝙧𝙖 𝙞𝙢𝙥𝙚𝙜𝙣𝙖𝙩𝙤 𝙥𝙚𝙧: ```" + await afk_reason() + "```") USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply("I'm AFK right now." f"\nBecause I'm `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"Masih belom balik sabar,.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS ISAFK = gvarstatus("AFK_STATUS") AFKREASON = gvarstatus("AFK_REASON") if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply( f"Aye, mera boss busy hai coz `{AFKREASON}`. Me usko btadunga tab tak chup reh." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 2 == 0: if AFKREASON: await mention.reply( f"He ain't vella like you.Currently busy with `{AFKREASON}`." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ global ISAFK global USERS global COUNT_MSG if sender.is_private and not (await sender.get_sender()).bot: if ISAFK: if sender.sender_id not in USERS: await sender.reply( f"Abey Gaandu, My boss is AFK due to `{AFKREASON}`." "\nI'll ping him to look into the message soon 😉." ) USERS.update({sender.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif sender.sender_id in USERS: if USERS[sender.sender_id] % 5 == 0: await sender.reply( "Sorry Bitch,But my boss is still not here." "\nTry to ping him a little later. I am sorry 😖." f"\nHe told me he was busy with `{AFKREASON}`." ) USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ global ISAFK global USERS global COUNT_MSG global AFKREASON if sender.is_private and not (await sender.get_sender()).bot: if ISAFK: if sender.sender_id not in USERS: if AFKREASON: await sender.reply( f"Sorry! I am AFK due to `{AFKREASON}`. I'll respond as soon I come back." ) else: await sender.reply(str(random.choice(AFKSTR))) USERS.update({sender.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif sender.sender_id in USERS: if USERS[sender.sender_id] % 5 == 0: if AFKREASON: await sender.reply( f"Sorry! But I'm still not back yet. Currently busy with `{AFKREASON}`." ) else: await sender.reply(str(random.choice(AFKSTR))) USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[sender.sender_id] = USERS[sender.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global is_afk if mention.message.mentioned and not (await mention.get_sender()).bot: if is_afk: if mention.sender_id not in USERS: if afk_reason: await mention.reply(f"I'm AFK right now.\ \nReason: `{afk_reason}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if afk_reason: await mention.reply(f"I'm still AFK.\ \nReason: `{afk_reason}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK global AFFKREASON ISAFK_SQL = False AFKREASON_SQL = None if afk_db: ISAFK_SQL = gvarstatus("AFK_STATUS") AFKREASON_SQL = gvarstatus("AFK_REASON") EXCUSE = AFKREASON_SQL if afk_db else AFKREASON if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK or ISAFK_SQL: if mention.sender_id not in USERS: if EXCUSE: await mention.reply(f"I'm AFK right now.\ \nReason: `{EXCUSE}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if EXCUSE: await mention.reply( f"In case you didn't notice, I'm still AFK.\ \nReason: `{EXCUSE}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(e): global COUNT_MSG global USERS global ISAFK if e.message.mentioned and not (await e.get_sender()).bot: if ISAFK: if e.sender_id not in USERS: await e.reply( "My Master is AFK! due to```" + AFKREASON + "```. I will ping him ! when he comes online." ) USERS.update({e.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif e.sender_id in USERS: if USERS[e.sender_id] % 5 == 0: await e.reply( "Sorry! But my boss is still not here. " "Try to ping him a little later. I am sorry😖." "He told me he was busy with ```" + AFKREASON + "```" ) USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS ISAFK = gvarstatus("AFK_STATUS") AFKREASON = gvarstatus("AFK_REASON") if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply( f"Sorry! I am AFK because of `{AFKREASON}`. I'll have a look at this as soon as I come back." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 2 == 0: if AFKREASON: await mention.reply( f"Sorry! But I'm still not back yet. Currently busy with `{AFKREASON}`." ) else: await mention.reply(str(random.choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and ISAFK: is_bot = False if (sender := await mention.get_sender()): is_bot = sender.bot if not is_bot and mention.sender_id not in USERS: if AFKREASON: await mention.reply("I'm AFK right now." f"\nBecause `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) else: if not is_bot and sender: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply(f"I'm still AFK.\ \nReason: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK if mention.message.mentioned and not (await mention.get_sender()).bot: if ISAFK: if mention.sender_id not in USERS: if AFKREASON: await mention.reply("SAYA SEDANG OFFLINE SEKARANG." f"\nKarena Saya`{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply("SAYA SEDANG OFFLINE." f"\nKarena: `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """ This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS if not is_redis_alive(): return IsAway = await is_afk() if mention.message.mentioned and not (await mention.get_sender()).bot: if IsAway is True: if mention.sender_id not in USERS: await mention.reply( "Sorry! My master is AFK due to " + await afk_reason() + ". Would ping him to look into the message soon😉") USERS.update({mention.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif mention.sender_id in USERS: if USERS[mention.sender_id] % 5 == 0: await mention.reply( "Sorry! But my master is still not here. " "Try to ping him a little later. I am sorry😖." "He told me he was busy with ```" + await afk_reason() + "```") USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def afk_on_pm(sender): """ Function which informs people that you are AFK in PM """ global ISAFK global USERS global COUNT_MSG global COUNT_MSG global USERS global ISAFK global USER_AFK # pylint:disable=E0602 global afk_time # pylint:disable=E0602 global afk_start global afk_end back_alivee = datetime.now() afk_end = back_alivee.replace(microsecond=0) afk_since = "algum tempo atrás" if (sender.is_private and sender.sender_id != 777000 and not (await sender.get_sender()).bot): if PM_AUTO_BAN: try: from userbot.modules.sql_helper.pm_permit_sql import is_approved apprv = is_approved(sender.sender_id) except AttributeError: apprv = True else: apprv = True if apprv and ISAFK: now = datetime.now() datime_since_afk = now - afk_time # pylint:disable=E0602 time = float(datime_since_afk.seconds) days = time // (24 * 3600) time = time % (24 * 3600) hours = time // 3600 time %= 3600 minutes = time // 60 time %= 60 seconds = time if days == 1: afk_since = "Ontem" elif days > 1: if days > 6: date = now + datetime.timedelta( days=-days, hours=-hours, minutes=-minutes) afk_since = date.strftime("%A, %Y %B %m, %H:%I") else: wday = now + datetime.timedelta(days=-days) afk_since = wday.strftime("%A") elif hours > 1: afk_since = f"`{int(hours)}h{int(minutes)}m`" elif minutes > 0: afk_since = f"`{int(minutes)}m{int(seconds)}s`" else: afk_since = f"`{int(seconds)}s`" if AFKREASON: await sender.reply(f"Estou ausente fazem {afk_since}.\ \nRazão: `{AFKREASON}`") else: await sender.reply(str(choice(AFKSTR))) USERS.update({sender.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1
async def mention_afk(e): global COUNT_MSG global USERS global ISAFK if e.message.mentioned and not (await e.get_sender()).bot: if ISAFK: if e.sender_id not in USERS: await e.reply( "Boss is offline! he told that ```" + AFKREASON + "```. I Would ping him to look into the message when he online" ) USERS.update({e.sender_id: 1}) COUNT_MSG = COUNT_MSG + 1 elif e.sender_id in USERS: if USERS[e.sender_id] % 5 == 0: await e.reply( "Sorry! But my boss is still not here. " "Try to ping him a little later. I am sorry😖." "He told me he was busy with ```" + AFKREASON + "```" ) USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1 else: USERS[e.sender_id] = USERS[e.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1
async def mention_afk(mention): """This function takes care of notifying the people who mention you that you are AFK.""" global COUNT_MSG global USERS global ISAFK global USER_AFK # pylint:disable=E0602 global afk_time # pylint:disable=E0602 global afk_start global afk_end user = await bot.get_me() # pylint:disable=E0602 back_alivee = datetime.now() afk_end = back_alivee.replace(microsecond=0) afk_since = "**Terakhir Online**" if mention.message.mentioned and not (await mention.get_sender()).bot and ISAFK: now = datetime.now() datime_since_afk = now - afk_time # pylint:disable=E0602 time = float(datime_since_afk.seconds) days = time // (24 * 3600) time %= 24 * 3600 hours = time // 3600 time %= 3600 minutes = time // 60 time %= 60 seconds = time if days == 1: afk_since = "**Kemarin**" elif days > 1: if days > 6: date = now + datetime.timedelta( days=-days, hours=-hours, minutes=-minutes) afk_since = date.strftime("%A, %Y %B %m, %H:%I") else: wday = now + datetime.timedelta(days=-days) afk_since = wday.strftime("%A") elif hours > 1: afk_since = f"`{int(hours)} Jam {int(minutes)} Menit`" elif minutes > 0: afk_since = f"`{int(minutes)} Menit {int(seconds)} Detik`" else: afk_since = f"`{int(seconds)} Detik`" if mention.sender_id not in USERS: if AFKREASON: await mention.reply( f"**✘ {ALIVE_NAME} Sedang OFF ✘** {afk_since} **Yang Lalu.**\ \n✦҈͜͡➳ **Karena :** `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS.update({mention.sender_id: 1}) else: if USERS[mention.sender_id] % randint(2, 4) == 0: if AFKREASON: await mention.reply( f"**✘ {ALIVE_NAME} Masih OFF ✘** {afk_since} **Yang Lalu.**\ \n✦҈͜͡➳ **Karena :** `{AFKREASON}`") else: await mention.reply(str(choice(AFKSTR))) USERS[mention.sender_id] = USERS[mention.sender_id] + 1 COUNT_MSG = COUNT_MSG + 1