Beispiel #1
0
async def cas(c: TelePyroBot, m: Message):
    user_id, user_first_name = extract_user(c, m)
    results = requests.get(
        f"https://api.cas.chat/check?user_id={user_id}").json()
    offenses_cas = results["result"]["offenses"]
    offense_msg = results["result"]["messages"]
    cas_ban_time = results["result"]["time_added"]
    try:
        text = (f"**User ID:** `{user_id}`\n"
                f"**Name:** `{user_first_name}`\n"
                f"**Offenses:** `{offenses_cas}`\n"
                f"**Messages:** `\n{offense_msg}`\n"
                f"**Time Added:** `{cas_ban_time}`")
    except:
        text = "`Not banned in CAS`"
    await m.edit(text, parse_mode="markdown")
    return
Beispiel #2
0
async def approve_pm(c: TelePyroBot, m: Message):
    if m.chat.type == "private":
        user_id = m.chat.id
    else:
        user_id, user_first_name = extract_user(message)
    db.set_whitelist(user_id, True)
    user = await c.get_users(user_id)
    await m.edit_text("**__PM permission was approved__** for {}".format(
        mention_markdown(user.first_name, user_id)))
    if db.get_msg_id(m.chat.id):
        old_msg_id = db.get_msg_id(m.chat.id)
        await c.delete_messages(chat_id=m.chat.id, message_ids=old_msg_id)
    await c.send_message(
        PRIVATE_GROUP_ID,
        "{} **is approved to contact you in PM!**".format(
            mention_markdown(user.first_name, user_id)),
    )
    await asyncio.sleep(5)
    await m.delete()