Ejemplo n.º 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]}!")
Ejemplo n.º 2
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]}!")
Ejemplo n.º 3
0
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]}!")
Ejemplo n.º 4
0
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]}!")