コード例 #1
0
async def temp_ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    if not len(message.command) > 1:
        return

    user_id, user_first_name = extract_user(message)

    until_date_val = extract_time(message.command[1])
    if until_date_val is None:
        await message.reply_text(
            ("അസാധുവായ സമയ തരം വ്യക്തമാക്കി. "
             "പ്രതീക്ഷിച്ചതു m, h, or d, കിട്ടിയത്: {}").format(
                 message.command[1][-1]))
        return

    try:
        await message.chat.kick_member(user_id=user_id,
                                       until_date=until_date_val)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("വേറെ ഒരാളും പൊടി പാറിപ്പിക്കുന്നു..! "
                                     f"{user_first_name}"
                                     f" banned for {message.command[1]}!")
        else:
            await message.reply_text("വേറെ ഒരാളും പൊടി പാറിപ്പിക്കുന്നു..! "
                                     f"<a href='tg://user?id={user_id}'>"
                                     "ലവനെ"
                                     "</a>"
                                     f" banned for {message.command[1]}!")
コード例 #2
0
ファイル: ban.py プロジェクト: SkueletorTlg/PyroGram
async def ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.kick_member(
            user_id=user_id
        )
    except Exception as error:
        await message.reply_text(
            str(error)
        )
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text(
                "വേറെ ഒരാളും പൊടി പാറിപ്പിക്കുന്നു..! "
                f"{user_first_name}"
                " നെ വിലക്കിയിരിക്കുന്നു."
            )
        else:
            await message.reply_text(
                "വേറെ ഒരാളും പൊടി പാറിപ്പിക്കുന്നു..! "
                f"<a href='tg://user?id={user_id}'>"
                f"{user_first_name}"
                "</a>"
                " നെ വിലക്കിയിരിക്കുന്നു."
            )
コード例 #3
0
ファイル: whois.py プロジェクト: vikramaditya1190/PyroGramBot
async def who_is(client, message):
    """ extract user information """
    status_message = await message.reply_text("🤔😳😳🙄")
    from_user = None
    from_user_id, _ = extract_user(message)
    try:
        user_id = from_user_id
        if not str(user_id).startswith("@"):
            user_id = int(user_id)
        from_user = await client.get_users(user_id)
    except Exception as error:
        await status_message.edit(str(error))
        return
    if from_user is None:
        await status_message.edit("no valid user_id / message specified")
    else:
        message_out_str = ""
        message_out_str += f"ID: <code>{from_user.id}</code>\n"
        message_out_str += f"First Name: <a href='tg://user?id={from_user.id}'>"
        message_out_str += from_user.first_name
        message_out_str += "</a>\n"
        message_out_str += f"Last Name: {from_user.last_name}\n"
        message_out_str += f"DC ID: <code>{from_user.dc_id}</code>\n"
        chat_photo = from_user.photo
        local_user_photo = await client.download_media(
            message=chat_photo.big_file_id)
        await message.reply_photo(
            photo=local_user_photo,
            quote=True,
            caption=message_out_str,
            parse_mode="html",
            # ttl_seconds=,
            disable_notification=True)
        os.remove(local_user_photo)
        await status_message.delete()
コード例 #4
0
ファイル: restrict.py プロジェクト: wdtgbot/PyroGramBot
async def temp_mute_user(_, message):
    if not len(message.command) > 1:
        return

    user_id, user_first_name = extract_user(message)

    until_date_val = extract_time(message.command[1])
    if until_date_val is None:
        await message.reply_text(
            ("അസാധുവായ സമയ തരം വ്യക്തമാക്കി. "
             "പ്രതീക്ഷിച്ചതു m, h, or d, കിട്ടിയത്: {}").format(
                 message.command[1][-1]))
        return

    try:
        await message.chat.restrict_member(user_id=user_id,
                                           permissions=ChatPermissions(),
                                           until_date=until_date_val)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("കുറച്ചുനേരം മിണ്ടാതിരിക്ക്! 😠"
                                     f"{user_first_name}"
                                     f" muted for {message.command[1]}!")
        else:
            await message.reply_text("കുറച്ചുനേരം മിണ്ടാതിരിക്ക്! 😠"
                                     f"<a href='tg://user?id={user_id}'>"
                                     "ലവന്റെ"
                                     "</a>"
                                     " വായ "
                                     f" muted for {message.command[1]}!")
コード例 #5
0
ファイル: unban.py プロジェクト: cdfxscrq/PyroGramUserBot
async def un_ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.unban_member(
            user_id=user_id
        )
    except Exception as error:
        await message.reply_text(
            str(error)
        )
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text(
                "ശരി, മാറ്റിയിട്ടുണ്ട്... ഇനി "
                f"{user_first_name} ക്ക് "
                " ഗ്രൂപ്പിൽ ചേരാൻ കഴിയും!"
            )
        else:
            await message.reply_text(
                "ശരി, മാറ്റിയിട്ടുണ്ട്... ഇനി "
                f"<a href='tg://user?id={user_id}'>"
                f"{user_first_name}"
                "</a> ക്ക് "
                " ഗ്രൂപ്പിൽ ചേരാൻ കഴിയും!"
            )
コード例 #6
0
ファイル: restrict.py プロジェクト: root435/PyroGramBot
async def temp_mute_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    if not len(message.command) > 1:
        return

    user_id, user_first_name = extract_user(message)

    until_date_val = extract_time(message.command[1])
    if until_date_val is None:
        await message.reply_text(("Invalid time type specified."
                                  "Expected m, h, or d, obtained: {}").format(
                                      message.command[1][-1]))
        return

    try:
        await message.chat.restrict_member(user_id=user_id,
                                           permissions=ChatPermissions(),
                                           until_date=until_date_val)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("shhh... quiet now! 😠"
                                     f"{user_first_name}"
                                     f" muted for {message.command[1]}!")
        else:
            await message.reply_text("shhh... quiet now! 😠"
                                     f"<a href='tg://user?id={user_id}'>"
                                     "Of Lavender"
                                     "</a>"
                                     " Mouth "
                                     f" muted for {message.command[1]}!")
コード例 #7
0
async def un_ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.unban_member(
            user_id=user_id
        )
    except Exception as error:
        await message.reply_text(
            str(error)
        )
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text(
                " Fine.... "
                f"{user_first_name} "
                " Can Join again!"
            )
        else:
            await message.reply_text(
                " Fine.... "
                f"<a href='tg://user?id={user_id}'>"
                f"{user_first_name}"
                "</a> "
                " Can Join again!"
            )
コード例 #8
0
async def temp_ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    if not len(message.command) > 1:
        return

    user_id, user_first_name = extract_user(message)

    until_date_val = extract_time(message.command[1])
    if until_date_val is None:
        await message.reply_text(("Invalid time type specified. "
                                  "Expected m, h, or d, obtained: {}").format(
                                      message.command[1][-1]))
        return

    try:
        await message.chat.kick_member(user_id=user_id,
                                       until_date=until_date_val)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("Someone is dusting off ..! "
                                     f"{user_first_name}"
                                     f" banned for {message.command[1]}!")
        else:
            await message.reply_text("Someone is dusting off ..!"
                                     f"<a href='tg://user?id={user_id}'>"
                                     "Bye !!"
                                     "</a>"
                                     f" banned for {message.command[1]}!")
コード例 #9
0
ファイル: restrict.py プロジェクト: pyroadminbot/pyroadminbot
async def mute_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.restrict_member(
            user_id=user_id,
            permissions=ChatPermissions(
            )
        )
    except Exception as error:
        await message.reply_text(
            str(error)
        )
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text(
                "👍🏻 "
                f"{user_first_name}"
                " muted! 🤐"
            )
        else:
            await message.reply_text(
                "👍🏻 "
                f"<a href='tg://user?id={user_id}'>"
                "he is"
                "</a>"
                " muted 🤐"
            )
コード例 #10
0
ファイル: whois.py プロジェクト: TermuxDad/PyroGramBot
async def who_is(client, message):
    """ extract user information """
    status_message = await message.reply_text("🤔😳😳🙄")
    from_user = None
    from_user_id, _ = extract_user(message)
    try:
        from_user = await client.get_users(from_user_id)
    except Exception as error:
        await status_message.edit(str(error))
        return
    if from_user is None:
        await status_message.edit("no valid user_id / message specified")
        return

    first_name = from_user.first_name or ""
    last_name = from_user.last_name or ""
    username = from_user.username or ""

    message_out_str = (
        "<b>Name:</b> "
        f"<a href='tg://user?id={from_user.id}'>{first_name}</a>\n"
        f"<b>Suffix:</b> {last_name}\n"
        f"<b>Username:</b> @{username}\n"
        f"<b>User ID:</b> <code>{from_user.id}</code>\n"
        f"<b>User Link:</b> {from_user.mention}\n"
        if from_user.username else ""
        f"<b>Is Deleted:</b> True\n" if from_user.is_deleted else ""
        f"<b>Is Verified:</b> True" if from_user.is_verified else ""
        f"<b>Is Scam:</b> True" if from_user.is_scam else ""
        # f"<b>Is Fake:</b> True" if from_user.is_fake else ""
        f"<b>Last Seen:</b> <code>{last_online(from_user)}</code>\n\n")

    if message.chat.type in ["supergroup", "channel"]:
        try:
            chat_member_p = await message.chat.get_member(from_user.id)
            joined_date = datetime.fromtimestamp(
                chat_member_p.joined_date
                or time.time()).strftime("%Y.%m.%d %H:%M:%S")
            message_out_str += ("<b>Joined on:</b> <code>"
                                f"{joined_date}"
                                "</code>\n")
        except UserNotParticipant:
            pass
    chat_photo = from_user.photo
    if chat_photo:
        local_user_photo = await client.download_media(
            message=chat_photo.big_file_id)
        await message.reply_photo(photo=local_user_photo,
                                  quote=True,
                                  caption=message_out_str,
                                  disable_notification=True)
        os.remove(local_user_photo)
    else:
        await message.reply_text(text=message_out_str,
                                 quote=True,
                                 disable_notification=True)
    await status_message.delete()
コード例 #11
0
ファイル: whois.py プロジェクト: root435/PyroGramBot
async def who_is(client, message):
    """ extract user information """
    status_message = await message.reply_text(
        "wiat lemme find that in my fbi database...")
    from_user = None
    from_user_id, _ = extract_user(message)
    try:
        user_id = from_user_id
        if not str(user_id).startswith("@"):
            user_id = int(user_id)
        from_user = await client.get_users(user_id)
    except Exception as error:
        await status_message.edit(str(error))
        return
    if from_user is None:
        await status_message.edit("no valid user_id / message specified")
    else:
        message_out_str = ""
        message_out_str += f"ID: <code>{from_user.id}</code>\n"
        message_out_str += "First Name: "
        message_out_str += f"<a href='tg://user?id={from_user.id}'>"
        message_out_str += from_user.first_name or ""
        message_out_str += "</a>\n"
        last_name = from_user.last_name or ""
        message_out_str += f"Last Name: {last_name}\n"
        dc_id = from_user.dc_id or "[🙏 no profile photo 👀]"
        message_out_str += f"DC ID: <code>{dc_id}</code>\n"
        if message.chat.type in (("supergroup", "channel")):
            try:
                chat_member_p = await message.chat.get_member(from_user.id)
                joined_date = datetime.fromtimestamp(
                    chat_member_p.joined_date
                    or time.time()).strftime("%Y.%m.%d %H:%M:%S")
                message_out_str += ("<b>Joined On</b>: <code>"
                                    f"{joined_date}"
                                    "</code>\n")
            except UserNotParticipant:
                pass
        chat_photo = from_user.photo
        if chat_photo:
            local_user_photo = await client.download_media(
                message=chat_photo.big_file_id)
            await message.reply_photo(
                photo=local_user_photo,
                quote=True,
                caption=message_out_str,
                parse_mode="html",
                # ttl_seconds=,
                disable_notification=True)
            os.remove(local_user_photo)
        else:
            await message.reply_text(text=message_out_str,
                                     quote=True,
                                     parse_mode="html",
                                     disable_notification=True)
        await status_message.delete()
コード例 #12
0
async def who_is(client, message):
    """ extract user information """
    status_message = await message.reply_text(
        "🤔😳😳🙄"
    )
    from_user = None
    from_user_id, _ = extract_user(message)
    try:
        user_id = from_user_id
        if not str(user_id).startswith("@"):
            user_id = int(user_id)
        from_user = await client.get_users(user_id)
    except Exception as error:
        await status_message.edit(str(error))
        return
    if from_user is None:
        await status_message.edit("no valid user_id / message specified")
    else:
        message_out_str = ""
        message_out_str += f"ID: <code>{from_user.id}</code>\n"
        message_out_str += f"First Name: <a href='tg://user?id={from_user.id}'>"
        message_out_str += from_user.first_name
        message_out_str += "</a>\n"
        message_out_str += f"Last Name: {from_user.last_name}\n"
        message_out_str += f"DC ID: <code>{from_user.dc_id}</code>\n"
        if message.chat.type in (("supergroup", "channel")):
            chat_member_p = await message.chat.get_member(from_user.id)
            joined_date = datetime.fromtimestamp(
                chat_member_p.joined_date or time.time()
            ).strftime("%Y-%m-%d_%H-%M-%S")
            message_out_str += f"<b>Joined On</b>: <code>{joined_date}</code>\n"
        chat_photo = from_user.photo
        if chat_photo:
            local_user_photo = await client.download_media(
                message=chat_photo.big_file_id
            )
            await message.reply_photo(
                photo=local_user_photo,
                quote=True,
                caption=message_out_str,
                parse_mode="html",
                # ttl_seconds=,
                disable_notification=True
            )
            os.remove(local_user_photo)
        else:
            await message.reply_text(
                text=message_out_str,
                quote=True,
                parse_mode="html",
                disable_notification=True
            )
        await status_message.delete()
コード例 #13
0
ファイル: restrict.py プロジェクト: wdtgbot/PyroGramBot
async def mute_user(_, message):
    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.restrict_member(user_id=user_id,
                                           permissions=ChatPermissions())
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("👍🏻 "
                                     f"{user_first_name}"
                                     " ലവന്റെ വായടച്ചിട്ടുണ്ട്! 🤐")
        else:
            await message.reply_text("👍🏻 "
                                     f"<a href='tg://user?id={user_id}'>"
                                     "ലവന്റെ"
                                     "</a>"
                                     " വായടച്ചിട്ടുണ്ട്! 🤐")
コード例 #14
0
ファイル: unban.py プロジェクト: pyroadminbot/pyroadminbot
async def un_ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.unban_member(user_id=user_id)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("Okay, changed ... now"
                                     f"{user_first_name} to"
                                     " You can join the group!")
        else:
            await message.reply_text("Okay, changed ... now"
                                     f"<a href='tg://user?id={user_id}'>"
                                     f"{user_first_name}"
                                     "</a> to"
                                     " You can join the group!")
コード例 #15
0
ファイル: ban.py プロジェクト: root435/PyroGramBot
async def ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.kick_member(user_id=user_id)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text("Another one bites the dust! "
                                     f"{user_first_name}"
                                     " is banned.")
        else:
            await message.reply_text("Another one bites the dust! "
                                     f"<a href='tg://user?id={user_id}'>"
                                     f"{user_first_name}"
                                     "</a>"
                                     " is banned.")
コード例 #16
0
async def ban_user(_, message):
    is_admin = await admin_check(message)
    if not is_admin:
        return

    user_id, user_first_name = extract_user(message)

    try:
        await message.chat.kick_member(user_id=user_id)
    except Exception as error:
        await message.reply_text(str(error))
    else:
        if str(user_id).lower().startswith("@"):
            await message.reply_text(
                "Someone else is dusting off ..! "
                f"{user_first_name}"
                " You are Forbidden to enter this Group From Now !! ")
        else:
            await message.reply_text(
                "Someone else is dusting off ..! "
                f"<a href='tg://user?id={user_id}'>"
                f"{user_first_name}"
                "</a>"
                "You are Forbidden to enter this Group From Now !!")