Пример #1
0
async def _(event):
    if event.fwd_from:
        return
    global USER_AFK  # pylint:disable=E0602
    global afk_time  # pylint:disable=E0602
    global last_afk_message  # pylint:disable=E0602
    global afk_start
    global afk_end
    global reason
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if not USER_AFK:  # pylint:disable=E0602
        last_seen_status = await bot(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()  # pylint:disable=E0602
        USER_AFK = f"yes: {reason}"  # pylint:disable=E0602
        if reason:
            await bot.send_message(
                event.chat_id, f"**AFK(ON) con successo!**\n"
                f"**Motivo: {reason}**")
        else:
            await bot.send_message(event.chat_id, f"**AFK(ON) con successo!**")
        await asyncio.sleep(5)
        await event.delete()
        try:
            await bot.send_message(  # pylint:disable=E0602
                Var.PRIVATE_GROUP_ID,  # pylint:disable=E0602
                f"AFK ON {reason}")
        except Exception as e:  # pylint:disable=C0103,W0703
            logger.warn(str(e))  # pylint:disable=E0602
Пример #2
0
async def _(event):
    if event.fwd_from:
        return
    global USER_AFK  # pylint:disable=E0602
    global afk_time  # pylint:disable=E0602
    global last_afk_message  # pylint:disable=E0602
    global afk_start
    global afk_end
    global reason
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if not USER_AFK:  # pylint:disable=E0602
        last_seen_status = await borg(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()  # pylint:disable=E0602
        USER_AFK = f"yes: {reason}"  # pylint:disable=E0602
        if reason:
            await borg.send_message(
                event.chat_id,
                f"**I shall be Going afk!** __because ~ {reason}__")
        else:
            await borg.send_message(event.chat_id, f"**I am Going afk!**")
        await asyncio.sleep(5)
        await event.delete()
        try:
            await borg.send_message(  # pylint:disable=E0602
                Config.PRIVATE_GROUP_BOT_API_ID,  # pylint:disable=E0602
                f"Set AFK mode to True, and Reason is {reason}")
        except Exception as e:  # pylint:disable=C0103,W0703
            logger.warn(str(e))  # pylint:disable=E0602
Пример #3
0
async def _(event):
    if event.fwd_from:
        return
    global USER_AFK  # pylint:disable=E0602
    global afk_time  # pylint:disable=E0602
    global last_afk_message  # pylint:disable=E0602
    global reason
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    reason = event.pattern_match.group(1)
    me = await borg.get_me()
    me.first_name
    (me.last_name)
    if not USER_AFK:  # pylint:disable=E0602
        last_seen_status = await borg(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()  # pylint:disable=E0602
        USER_AFK = f"yes: {reason}"  # pylint:disable=E0602
        if reason:
            await event.edit(
                f"`Your status has been set to AFK By [NinjaDeep🇮🇳].`\n**Reason** - __{reason}__"
            )
        else:
            await event.edit(
                f"`Your status has been set to AFK By [NinjaDeep🇮🇳].`")
        await asyncio.sleep(5)
        await event.delete()
        try:
            await borg.send_message(  # pylint:disable=E0602
                Config.PRIVATE_GROUP_BOT_API_ID,  # pylint:disable=E0602
                f"#AFK\nSet AFK mode to True, with Helping NinjaDeep Reason - {reason}",
            )
        except Exception as e:  # pylint:disable=C0103,W0703
            logger.warn(str(e))  # pylint:disable=E0602
Пример #4
0
async def _(event):
    if event.fwd_from:
        return
    global USER_night  # pylint:disable=E0602
    global night_time  # pylint:disable=E0602
    global last_night_message  # pylint:disable=E0602
    global reason
    USER_night = {}
# ported from madboy482

# kang mat kr lawde, muh tod dunga
    night_time = None
    last_night_message = {}
    reason = event.pattern_match.group(1)
    if not USER_night:  # pylint:disable=E0602
        last_seen_status = await borg(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(types.InputPrivacyKeyStatusTimestamp())
        )
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            night_time = datetime.datetime.now()  # pylint:disable=E0602
        USER_night = f"yes: {reason}"  # pylint:disable=E0602
        if reason:
            await event.edit(f"Mᴏɪ Bᴏss Iᴢ Sᴛᴜᴅʏɪɴɢ\n\nDɴD")
        else:
            await event.edit(f"Mᴏɪ Bᴏss Iᴢ Gᴏɪɴɢ Tᴏ Sᴛᴜᴅʏ")
        await asyncio.sleep(5)
# ported from madboy482

# kang mat kr lawde, muh tod dunga
        await event.delete()
        try:
            await borg.send_message(  # pylint:disable=E0602
                Var.PLUGIN_CHANNEL, f"Mᴏɪ Oᴡɴᴇʀ Iᴢ Sᴛᴜᴅʏɪɴɢ\n\n`Pᴜʀᴇ Dɪɴ Bᴀᴋᴄʜᴏᴅɪ Mᴀʀᴛᴀ Hᴀɪ, Aᴜʀ Aʙ Pᴀᴅʜ Rʜᴀ Hᴀɪ`"  # pylint:disable=E0602
            )
        except Exception as e:  # pylint:disable=C0103,W0703
            logger.warn(str(e))  # pylint:disable=E0602
Пример #5
0
async def _(event):
    if event.fwd_from:
        return
    reason = event.pattern_match.group(1)
    if not borg.storage.USER_AFK:  # pylint:disable=E0602
        last_seen_status = await borg(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            borg.storage.afk_time = datetime.datetime.now()  # pylint:disable=E0602
        borg.storage.USER_AFK.update({"yes": reason})  # pylint:disable=E0602
        if reason:
            await event.edit(
                f"🙂🙃🙂🙃\n**NOBITA Is AFK**\n**Reason:** {reason}\n🙂🙃🙂🙃")
        else:
            await event.edit(f"Set AFK mode to True")
        await asyncio.sleep(5)
        await event.delete()
        try:
            await borg.send_message(  # pylint:disable=E0602
                Config.PRIVATE_GROUP_BOT_API_ID,  # pylint:disable=E0602
                f"Set AFK mode to True, and Reason is {reason}")
        except Exception as e:  # pylint:disable=C0103,W0703
            logger.warn(str(e))  # pylint:disable=E0602
Пример #6
0
async def _(event):
    if event.fwd_from:
        return
    global USERAFK_ON
    global afk_time
    global last_afk_message
    global afk_start
    global afk_end
    global reason
    USERAFK_ON = {}
    afk_time = None
    last_afk_message = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    if not USERAFK_ON:
        reason = event.pattern_match.group(1)
        last_seen_status = await borg(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.now()
        USERAFK_ON = f"on: {reason}"
        if reason:
            await borg.send_message(
                event.chat_id,
                f"**I shall be Going afk!** __because ~ {reason}__")
        else:
            await borg.send_message(event.chat_id, f"**I am Going afk!**")
        await asyncio.sleep(5)
        await event.delete()
        if BOTLOG:
            await borg.send_message(
                BOTLOG_CHATID,
                f"#AFKTRUE \nSet AFK mode to True, and Reason is {reason}",
            )
Пример #7
0
async def _(event):
    if event.fwd_from:
        return
    global USER_AFK
    global afk_time
    global last_afk_message
    global afk_start
    global afk_end
    global reason
    global thundrgang
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    afk_end = {}
    thundrgang = "False"
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    if not USER_AFK:
        if event.reply_to_msg_id:
            reply_message = await event.get_reply_message()
            media = await thunderbot.download_media(reply_message, "AFK_media")
            try:
                url = upload_file(media)
                os.remove(media)
            except BaseException:
                pass
            input_str = event.pattern_match.group(1)
            if url:
                if input_str is not None:
                    thundrgang = "True"
                    reason = f"`{input_str}`[‎‏‏‎ ‎](https://telegra.ph/{url[0]})"
                else:
                    thundrgang = "False"
                    reason = f"[‎‏‏‎ ‎](https://telegra.ph/{url[0]})"
            else:
                if input_str is not None:
                    reason = f"`{input_str}`"
        else:
            input_str = event.pattern_match.group(1)
            reason = f"`{input_str}`"
        last_seen_status = await event.client(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.now()
        USER_AFK = f"on: {reason}"
        if reason:
            await event.edit(
                f"`Your status has been set to AFK.`\n**Reason😌** - {reason}")
            await asyncio.sleep(5)
            await event.delete()
        else:
            await event.edit("`Your status has been set to AFK.`")
            await asyncio.sleep(5)
            await event.delete()
        if BOTLOG:
            if reason:
                await event.client.send_message(
                    Var.PRIVATE_GROUP_ID,
                    f"#AFK \nAFK - Active\nReason😌 - {reason}",
                )
            else:
                await event.client.send_message(
                    Var.PRIVATE_GROUP_ID,
                    f"#AFK \nAFK - Active\nReason😌 - None Specified.",
                )
Пример #8
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await bot(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(
                        event.chat_id,
                        f"#AFK\n**Saya OFFLINE Dulu**\n**Karena :** __{reason}__"
                    )
                else:
                    await bot.send_message(
                        event.chat_id,
                        f"#AFK\n**Saya OFFLINE Dulu**\n**Karena :** __{reason}__",
                        file=pic)
            except BaseException:
                await bot.send_message(
                    event.chat_id,
                    f"#AFK\n**Saya OFFLINE Dulu**\n**Karena :** __{reason}__")
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(event.chat_id,
                                           f"#AFK\n**Saya Offline dulu..**")
                else:
                    await bot.send_message(event.chat_id,
                                           f"#AFK\n**Saya Offline dulu..**",
                                           file=pic)
            except BaseException:
                await bot.send_message(event.chat_id,
                                       f"#AFK\n**Saya Offline dulu..**")
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(
                        BOTLOG_CHATID,
                        f"#AFK\n`Kamu Sekarang` **AFK**\n`Karena:` {reason}")
                else:
                    await bot.send_message(
                        BOTLOG_CHATID,
                        f"#AFK\n`Kamu Sekarang` **AFK**\n`Karena:` {reason}",
                        file=pic)
            elif reason:
                await bot.send_message(
                    BOTLOG_CHATID,
                    f"#AFK\n`Kamu Sekarang` **AFK**\n`Karena:` {reason}")
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(BOTLOG_CHATID,
                                           f"#AFK\n`Kamu Sekarang` **AFK**")
                else:
                    await bot.send_message(BOTLOG_CHATID,
                                           f"#AFK\n`Kamu Sekarang` **AFK**",
                                           file=pic)
            else:
                await bot.send_message(BOTLOG_CHATID,
                                       f"#AFK\n`Kamu Sekarang` **AFK**")
        except Exception as e:
            BOTLOG_CHATIDger.warn(str(e))
Пример #9
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await ultroid_bot(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(event.chat_id, file=pic)
                    await ultroid_bot.send_message(
                        event.chat_id, f"Afk __because ~ {reason}__")
                else:
                    await ultroid_bot.send_message(
                        event.chat_id, f"Afk __because ~ {reason}__", file=pic)
            except BaseException:
                await ultroid_bot.send_message(event.chat_id,
                                               f"Afk __because ~ {reason}__")
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(event.chat_id, file=pic)
                    await ultroid_bot.send_message(event.chat_id,
                                                   f"**I am Going afk!**")
                else:
                    await ultroid_bot.send_message(event.chat_id,
                                                   f"**I am Going afk!**",
                                                   file=pic)
            except BaseException:
                await ultroid_bot.send_message(event.chat_id,
                                               f"**I am Going afk!**")
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(LOG, file=pic)
                    await ultroid_bot.send_message(
                        LOG, f"AFK mode to On and Reason is {reason}")
                else:
                    await ultroid_bot.send_message(
                        LOG,
                        f"AFK mode to On and Reason is {reason}",
                        file=pic)
            elif reason:
                await ultroid_bot.send_message(
                    LOG, f"AFK mode to On and Reason is {reason}")
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(LOG, file=pic)
                    await ultroid_bot.send_message(LOG, f"AFK mode to On")
                else:
                    await ultroid_bot.send_message(LOG,
                                                   f"AFK mode to On",
                                                   file=pic)
            else:
                await ultroid_bot.send_message(LOG, f"AFK mode to On")
        except Exception as e:
            logger.warn(str(e))
Пример #10
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await ultroid_bot(
            functions.account.GetPrivacyRequest(types.InputPrivacyKeyStatusTimestamp()),
        )
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(event.chat_id, file=pic)
                    await ultroid_bot.send_message(
                        event.chat_id,
                        get_string("afk_5").format(reason),
                    )
                else:
                    await ultroid_bot.send_message(
                        event.chat_id,
                        get_string("afk_5").format(reason),
                        file=pic,
                    )
            except BaseException:
                await ultroid_bot.send_message(
                    event.chat_id,
                    get_string("afk_5").format(reason),
                )
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(event.chat_id, file=pic)
                    await ultroid_bot.send_message(event.chat_id, get_string("afk_6"))
                else:
                    await ultroid_bot.send_message(
                        event.chat_id,
                        get_string("afk_6"),
                        file=pic,
                    )
            except BaseException:
                await ultroid_bot.send_message(event.chat_id, get_string("afk_6"))
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(LOG, file=pic)
                    await ultroid_bot.send_message(
                        LOG,
                        get_string("afk_7").format(reason),
                    )
                else:
                    await ultroid_bot.send_message(
                        LOG,
                        get_string("afk_7").format(reason),
                        file=pic,
                    )
            elif reason:
                await ultroid_bot.send_message(LOG, get_string("afk_7").format(reason))
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await ultroid_bot.send_message(LOG, file=pic)
                    await ultroid_bot.send_message(LOG, get_string("afk_8"))
                else:
                    await ultroid_bot.send_message(LOG, get_string("afk_8"), file=pic)
            else:
                await ultroid_bot.send_message(LOG, get_string("afk_8"))
        except BaseException:
            pass
Пример #11
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    user = await king_bot.get_me()
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await king_bot(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")) and user.last_name:
                    await king_bot.send_message(event.chat_id, file=pic)
                    await king_bot.send_message(
                        event.chat_id, f"`Sedang AFK`\n\n**Karena:** {reason}")
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
                else:
                    await king_bot.send_message(
                        event.chat_id,
                        f"`Sedang AFK`\n\n**Karena:** {reason}",
                        file=pic)
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name=user.last_name +
                                             "[𝓐𝓕𝓚]"))
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
            except BaseException:
                await king_bot.send_message(
                    event.chat_id, f"`Sedang AFK`\n\n**Karena:** {reason}")
                if user.last_name:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name=user.last_name +
                                             "[𝓐𝓕𝓚]"))
                else:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name="[𝓐𝓕𝓚]"))
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await king_bot.send_message(event.chat_id, file=pic)
                    await king_bot.send_message(event.chat_id,
                                                f"Sedang **OFFLINE**")
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
                else:
                    await king_bot.send_message(event.chat_id,
                                                f"Sedang **OFFLINE**")
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
            except BaseException:
                await king_bot.send_message(event.chat_id,
                                            f"Sedang **OFFLINE**")
                if user.last_name:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name=user.last_name +
                                             "[𝓐𝓕𝓚]"))
                else:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name="[𝓐𝓕𝓚]"))
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await king_bot.send_message(LOG, file=pic)
                    await king_bot.send_message(
                        LOG, f"Sedang **OFFLINE**\nKarena: {reason}")
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
                else:
                    await king_bot.send_message(
                        LOG, f"Sedang **OFLINE**\nKarena: {reason}", file=pic)
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
            elif reason:
                await king_bot.send_message(
                    LOG, f"Sedang **OFFLINE**\nKarena: {reason}")
                if user.last_name:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name=user.last_name +
                                             "[𝓐𝓕𝓚]"))
                else:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name="[𝓐𝓕𝓚]"))
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await king_bot.send_message(LOG, file=pic)
                    await king_bot.send_message(LOG, "`Lagi Offline`")
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
                else:
                    await king_bot.send_message(LOG,
                                                "`Lagi Offline`",
                                                file=pic)
                    if user.last_name:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name=user.last_name +
                                                 "[𝓐𝓕𝓚]"))
                    else:
                        await event.client(
                            UpdateProfileRequest(first_name=user.first_name,
                                                 last_name="[𝓐𝓕𝓚]"))
            else:
                await king_bot.send_message(LOG, "`Lagi Offline, Jangan Spam`")
                if user.last_name:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name=user.last_name +
                                             "[𝓐𝓕𝓚]"))
                else:
                    await event.client(
                        UpdateProfileRequest(first_name=user.first_name,
                                             last_name="[𝓐𝓕𝓚]"))
        except BaseException:
            pass
Пример #12
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await bot(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(
                        event.chat_id,
                        f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n**◈ Alasan :** `{reason}`\n╚══════━━━━━━━═════╝",
                    )
                else:
                    await bot.send_message(
                        event.chat_id,
                        f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n**◈ Alasan :** `{reason}`\n╚══════━━━━━━━═════╝",
                        file=pic,
                    )
            except BaseException:
                await bot.send_message(
                    event.chat_id,
                    f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n**◈ Alasan :** `{reason}`\n╚══════━━━━━━━═════╝",
                )
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(
                        event.chat_id,
                        f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n╚══════━━━━━━━═════╝"
                    )
                else:
                    await bot.send_message(
                        event.chat_id,
                        f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n╚══════━━━━━━━═════╝",
                        file=pic,
                    )
            except BaseException:
                await bot.send_message(
                    event.chat_id,
                    f"╔══════━━━━━━━═════╗\n**King {ALIVE_NAME} Telah AFK**\n╚══════━━━━━━━═════╝"
                )
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(
                        BOTLOG_CHATID,
                        f"#AFK\n**{ALIVE_NAME} Telah AFK**\n**◈ Alasan :** `{reason}`",
                    )
                else:
                    await bot.send_message(
                        BOTLOG_CHATID,
                        f"#AFK\n**{ALIVE_NAME} Sedang AFK**\n**◈ Alasan :** `{reason}`",
                        file=pic,
                    )
            elif reason:
                await bot.send_message(
                    BOTLOG_CHATID,
                    f"#AFK\n**{ALIVE_NAME} Masih AFK**\n**◈ Alasan :** `{reason}`",
                )
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(
                        BOTLOG_CHATID, f"#AFK\n**{ALIVE_NAME} Telah AFK**")
                else:
                    await bot.send_message(
                        BOTLOG_CHATID,
                        f"#AFK\n**{ALIVE_NAME} Sedang AFK**",
                        file=pic,
                    )
            else:
                await bot.send_message(
                    BOTLOG_CHATID, f"#AFK\n**{ALIVE_NAME} Masih aja AFK**")
        except Exception as e:
            BOTLOG_CHATIDger.warn(str(e))
Пример #13
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    user = await event.client.get_me()
    owner = user.first_name
    pic = await event.client.download_media(reply) if reply else None
    if not USER_AFK:
        last_seen_status = await event.client(
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await event.client.send_message(event.chat_id, file=pic)
                    await event.client.send_message(
                        event.chat_id,
                        f"\n❏ **{owner} Telah AFK**\n└ **Karena:** `{reason}`",
                    )
                else:
                    await event.client.send_message(
                        event.chat_id,
                        f"\n❏ **{owner} Telah AFK**\n└ **Karena:** `{reason}`",
                        file=pic,
                    )
            except BaseException:
                await event.client.send_message(
                    event.chat_id,
                    f"\n❏ **{owner} Telah AFK**\n└ **Karena:** `{reason}`",
                )
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await event.client.send_message(event.chat_id, file=pic)
                    await event.client.send_message(
                        event.chat_id, f"**✘ {owner} Telah AFK ✘**")
                else:
                    await event.client.send_message(
                        event.chat_id,
                        f"**✘ {owner} Telah AFK ✘**",
                        file=pic,
                    )
            except BaseException:
                await event.client.send_message(event.chat_id,
                                                f"**✘ {owner} Telah AFK ✘**")
        await event.delete()
Пример #14
0
async def _(event):
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    global USER_AFK
    global afk_time
    global last_afk_message
    global last_afk_msg
    global afk_start
    global afk_end
    global reason
    global pic
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    last_afk_msg = {}
    afk_end = {}
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    reason = event.pattern_match.group(1)
    if reply:
        pic = await event.client.download_media(reply)
    else:
        pic = None
    if not USER_AFK:
        last_seen_status = await bot(
            functions.account.GetPrivacyRequest(types.InputPrivacyKeyStatusTimestamp())
        )
        if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
            afk_time = datetime.datetime.now()
        USER_AFK = f"yes: {reason} {pic}"
        if reason:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(
                        event.chat_id, f"❍ 𝙋𝙀𝙎𝘼𝙉 𝙊𝙏𝙊𝙈𝘼𝙏𝙄𝙎\n\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾"
                    )
                else:
                    await bot.send_message(
                        event.chat_id, f"❍ 𝙋𝙀𝙎𝘼𝙉 𝙊𝙏𝙊𝙈𝘼𝙏𝙄𝙎\n\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾", file=pic
                    )
            except BaseException:
                await bot.send_message(
                    event.chat_id, f"❍ 𝙋𝙀𝙎𝘼𝙉 𝙊𝙏𝙊𝙈𝘼𝙏𝙄𝙎\n\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾"
                )
        else:
            try:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(event.chat_id, file=pic)
                    await bot.send_message(
                        event.chat_id, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ\n╰╼═════════╾**"
                    )
                else:
                    await bot.send_message(
                        event.chat_id, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n╰╼═════════╾", file=pic
                    )
            except BaseException:
                await bot.send_message(event.chat_id, f"**OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n╰╼═════════╾")
        await event.delete()
        try:
            if reason and pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(
                        BOTLOG_CHATID, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾"
                    )
                else:
                    await bot.send_message(
                        BOTLOG_CHATID, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾", file=pic
                    )
            elif reason:
                await bot.send_message(
                    BOTLOG_CHATID, f"\n**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n**▸ ᴋᴀʀᴇɴᴀ :** `{reason}`\n╰╼═════════╾"
                )
            elif pic:
                if pic.endswith((".tgs", ".webp")):
                    await bot.send_message(BOTLOG_CHATID, file=pic)
                    await bot.send_message(BOTLOG_CHATID, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n╰╼═════════╾")
                else:
                    await bot.send_message(BOTLOG_CHATID, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n╰╼═════════╾", file=pic)
            else:
                await bot.send_message(BOTLOG_CHATID, f"**⚡OᖴᖴᒪIᑎE**\n╭╼══════════════╾\n**▸ {ALIVE_NAME} ꜱᴇᴅᴀɴɢ ᴏꜰꜰʟɪɴᴇ**\n╰╼═════════╾")
        except Exception as e:
            BOTLOG_CHATIDger.warn(str(e))