Esempio n. 1
0
async def userid(client, message):
    chat = message.chat
    user = message.from_user
    if message.reply_to_message:
        if message.reply_to_message.forward_from:
            user_id = message.reply_to_message.from_user.id
            user = mention_markdown(
                message.reply_to_message.forward_from.id,
                message.reply_to_message.forward_from.first_name)
        else:
            user_id = message.reply_to_message.from_user.id
            user = mention_markdown(
                message.reply_to_message.from_user.id,
                message.reply_to_message.from_user.first_name)
    elif len(message.text.split()) >= 2:
        u = message.text.split()[1]
        u = await client.get_users(u)
        user_id = u.id
        user = mention_markdown(u.id, u.first_name)
    else:
        user_id = message.from_user.id
        user = mention_markdown(message.from_user.id,
                                message.from_user.first_name)
    text = "{}'s ID is `{}`\nThis chat id is `{}`".format(
        user, user_id, message.chat.id)
    await message.edit(text)
Esempio n. 2
0
async def afk_mentioned(client, message):
	if not DB_AVAIABLE:
		return
	global MENTIONED
	get = get_afk()
	if get and get['afk']:
		if "-" in str(message.chat.id):
			cid = str(message.chat.id)[4:]
		else:
			cid = str(message.chat.id)

		if cid in list(AFK_RESTIRECT):
			if int(AFK_RESTIRECT[cid]) >= int(time.time()):
				return
		AFK_RESTIRECT[cid] = int(time.time()) + DELAY_TIME
		if get['reason']:
			await message.reply("Sorry, {} is AFK!\nBecause of {}".format(mention_markdown(Owner, OwnerName), get['reason']))
		else:
			await message.reply("Sorry, {} is AFK!".format(mention_markdown(Owner, OwnerName)))

		content, message_type = get_message_type(message)
		if message_type == Types.TEXT:
			if message.text:
				text = message.text
			else:
				text = message.caption
		else:
			text = message_type.name

		MENTIONED.append({"user": message.from_user.first_name, "user_id": message.from_user.id, "chat": message.chat.title, "chat_id": cid, "text": text, "message_id": message.message_id})
		await client.send_message(Owner, "{} mentioned you in {}\n\n{}\n\nTotal count: `{}`\n\n{}".format(mention_markdown(message.from_user.id, message.from_user.first_name), message.chat.title, text[:3500], len(MENTIONED), f"[Go to message](https://t.me/c/{cid}/{message.message_id})"))
Esempio n. 3
0
async def afk(_, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    if len(message.text.split()) >= 2:
        set_afk(True, message.text.split(None, 1)[1])
        await message.edit(
            "{} is now AFK!\nBecause of {}".format(
                mention_markdown(message.from_user.id, message.from_user.first_name),
                message.text.split(None, 1)[1],
            )
        )
        await setbot.send_message(
            Owner,
            "You are now AFK!\nBecause of {}".format(message.text.split(None, 1)[1]),
        )
    else:
        set_afk(True, "")
        await message.edit(
            "{} is now AFK!".format(
                mention_markdown(message.from_user.id, message.from_user.first_name)
            )
        )
        await setbot.send_message(Owner, "You are now AFK!")
    await message.stop_propagation()
Esempio n. 4
0
async def dc_id_check(_client, message):
    user = message.from_user
    if message.reply_to_message:
        if message.reply_to_message.forward_from:
            dc_id = message.reply_to_message.forward_from.dc_id
            user = mention_markdown(
                message.reply_to_message.forward_from.id,
                message.reply_to_message.forward_from.first_name)
        else:
            dc_id = message.reply_to_message.from_user.dc_id
            user = mention_markdown(
                message.reply_to_message.from_user.id,
                message.reply_to_message.from_user.first_name)
    else:
        dc_id = user.dc_id
        user = mention_markdown(message.from_user.id,
                                message.from_user.first_name)
    if dc_id == 1:
        text = "{}'s assigned datacenter is **DC1**, located in **MIA, Miami FL, USA**".format(
            user)
    elif dc_id == 2:
        text = "{}'s assigned datacenter is **DC2**, located in **AMS, Amsterdam, NL**".format(
            user)
    elif dc_id == 3:
        text = "{}'s assigned datacenter is **DC3**, located in **MIA, Miami FL, USA**".format(
            user)
    elif dc_id == 4:
        text = "{}'s assigned datacenter is **DC4**, located in **AMS, Amsterdam, NL**".format(
            user)
    elif dc_id == 5:
        text = "{}'s assigned datacenter is **DC5**, located in **SIN, Singapore, SG**".format(
            user)
    else:
        text = "{}'s assigned datacenter is **Unknown**".format(user)
    await edrep(message, text=text)
Esempio n. 5
0
async def dc_id(client, message):
	chat = message.chat
	user = message.from_user
	if message.reply_to_message:
		if message.reply_to_message.forward_from:
			dc_id = await client.get_user_dc(message.reply_to_message.forward_from.id)
			user = mention_markdown(message.reply_to_message.forward_from.id, message.reply_to_message.forward_from.first_name)
		else:
			dc_id = await client.get_user_dc(message.reply_to_message.from_user.id)
			user = mention_markdown(message.reply_to_message.from_user.id, message.reply_to_message.from_user.first_name)
	else:
		dc_id = await client.get_user_dc(message.from_user.id)
		user = mention_markdown(message.from_user.id, message.from_user.first_name)
	if dc_id == 1:
		text = "{}'s assigned datacenter is **DC1**, located in **MIA, Miami FL, USA**".format(user)
	elif dc_id == 2:
		text = "{}'s assigned datacenter is **DC2**, located in **AMS, Amsterdam, NL**".format(user)
	elif dc_id == 3:
		text = "{}'s assigned datacenter is **DC3**, located in **MIA, Miami FL, USA**".format(user)
	elif dc_id == 4:
		text = "{}'s assigned datacenter is **DC4**, located in **AMS, Amsterdam, NL**".format(user)
	elif dc_id == 5:
		text = "{}'s assigned datacenter is **DC5**, located in **SIN, Singapore, SG**".format(user)
	else:
		text = "{}'s assigned datacenter is **Unknown**".format(user)
	await message.edit(text)
Esempio n. 6
0
async def adminlist(client, message):
    replyid = None
    toolong = False
    if len(message.text.split()) >= 2:
        chat = message.text.split(None, 1)[1]
        grup = await client.get_chat(chat)
    else:
        chat = message.chat.id
        grup = await client.get_chat(chat)
    if message.reply_to_message:
        replyid = message.reply_to_message.message_id
    alladmins = client.iter_chat_members(chat, filter="administrators")
    creator = []
    admin = []
    badmin = []
    async for a in alladmins:
        try:
            nama = a.user.first_name + " " + a.user.last_name
        except:
            nama = a.user.first_name
        if nama is None:
            nama = "☠️ Deleted account"
        if a.status == "administrator":
            if a.user.is_bot:
                badmin.append(mention_markdown(a.user.id, nama))
            else:
                admin.append(mention_markdown(a.user.id, nama))
        elif a.status == "creator":
            creator.append(mention_markdown(a.user.id, nama))
    admin.sort()
    badmin.sort()
    totaladmins = len(creator) + len(admin) + len(badmin)
    teks = "**Admins in {}**\n".format(grup.title)
    teks += "╒═══「 Creator 」\n"
    for x in creator:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += "╞══「 {} Human Administrator 」\n".format(len(admin))
    for x in admin:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += "╞══「 {} Bot Administrator 」\n".format(len(badmin))
    for x in badmin:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += "╘══「 Total {} Admins 」".format(totaladmins)
    if toolong:
        await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
    else:
        await message.edit(teks)
Esempio n. 7
0
async def adminlist(client, message):
    replyid = None
    toolong = False
    if len(message.text.split()) >= 2:
        chat = message.text.split(None, 1)[1]
    else:
        chat = message.chat.id
    grup = await client.get_chat(chat)
    if message.reply_to_message:
        replyid = message.reply_to_message.message_id
    alladmins = client.iter_chat_members(chat, filter="administrators")
    async for a in alladmins:
        try:
            nama = a.user.first_name + " " + a.user.last_name
        except:
            nama = a.user.first_name
        if nama is None:
            nama = "☠️ Deleted account"
        if a.status == "administrator":
            if a.user.is_bot:
                badmin.append(mention_markdown(a.user.id, nama))
            else:
                admin.append(mention_markdown(a.user.id, nama))
        elif a.status == "creator":
            creator.append(mention_markdown(a.user.id, nama))
    admin.sort()
    badmin.sort()
    totaladmins = len(creator) + len(admin) + len(badmin)
    teks = tld('adminlist_one').format(grup.title)
    for x in creator:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += tld('adminlist_two').format(len(admin))
    for x in admin:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += tld('adminlist_three').format(len(badmin))
    for x in badmin:
        teks += "│ • {}\n".format(x)
        if len(teks) >= 4096:
            await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
            teks = ""
            toolong = True
    teks += tld('adminlist_four').format(totaladmins)
    if toolong:
        await message.reply(message.chat.id, teks, reply_to_message_id=replyid)
    else:
        await edrep(message, text=teks)
Esempio n. 8
0
async def user_info(client, message):
    chat = message.chat
    user = message.from_user
    if message.reply_to_message:
        if message.reply_to_message.forward_from:
            user_id = message.reply_to_message.from_user.id
            user = await client.get_users(user_id)
            user_name = mention_markdown(
                message.reply_to_message.forward_from.id,
                message.reply_to_message.forward_from.first_name)
        else:
            user_id = message.reply_to_message.from_user.id
            user = await client.get_users(user_id)
            user_name = mention_markdown(
                message.reply_to_message.from_user.id,
                message.reply_to_message.from_user.first_name)
    elif len(message.text.split()) >= 2 and (message.text.split(
            None, 1)[1].isdigit() or message.text.split(None, 1)[1][0] == "@"):
        user_id = message.text.split()[1]
        user = await client.get_users(user_id)
        user_name = mention_markdown(user.id, user.first_name)
    else:
        user_id = message.from_user.id
        user = await client.get_users(user_id)
        user_name = mention_markdown(message.from_user.id,
                                     message.from_user.first_name)

    common_group = await app.get_common_chats(user_id)

    text = "**User info:**\n"
    text += "First Name: {}\n".format(user.first_name)
    text += "Last Name: {}\n".format(user.last_name) if user.last_name else ""
    text += "User ID: `{}`\n".format(user.id)
    text += "Username: @{}\n".format(user.username) if user.username else ""
    text += "User Type: {}\n".format("Bot" if user.is_bot else "Human")
    text += "User link: [link](tg://user?id={})\n".format(user.id)
    if user.id == int(Owner):
        text += "\n__This is myself__\n"
    elif user.is_verified:
        text += "\n__This account is verified__\n"
    # elif user.is_contact:
    # 	text +=	"\n__This user is on my contact__\n"
    elif user.is_scam:
        text += "\n__This account is labeled as SCAM__\n"
    elif user.is_deleted:
        text += "\n__This account has been deleted__\n"
    if common_group:
        text += "\n`{}` groups in common".format(len(common_group))
    await message.edit(text)
Esempio n. 9
0
async def afk_mentioned(client, message):
    global MENTIONED
    get = get_afk()
    if get and get['afk']:
        if "-" in str(message.chat.id):
            cid = str(message.chat.id)[4:]
        else:
            cid = str(message.chat.id)

        if cid in list(AFK_RESTIRECT):
            if int(AFK_RESTIRECT[cid]) >= int(time.time()):
                return
        AFK_RESTIRECT[cid] = int(time.time()) + DELAY_TIME
        if get['reason']:
            await message.reply("Maaf, {} Sedang AFK!\nKarena {}".format(
                mention_markdown(Owner, OwnerName), get['reason']))
        else:
            await message.reply("Maaf, {} Sedang AFK!".format(
                mention_markdown(Owner, OwnerName)))

        content, message_type = get_message_type(message)
        if message_type == Types.TEXT:
            if message.text:
                text = message.text
            else:
                text = message.caption
        else:
            text = message_type.name

        MENTIONED.append({
            "user": message.from_user.first_name,
            "user_id": message.from_user.id,
            "chat": message.chat.title,
            "chat_id": cid,
            "text": text,
            "message_id": message.message_id
        })
        button = InlineKeyboardMarkup([[
            InlineKeyboardButton("Pergi Ke Pesan",
                                 url="https://t.me/c/{}/{}".format(
                                     cid, message.message_id))
        ]])
        await setbot.send_message(
            Owner,
            "{} menyebut nama mu di {}\n\n{}\n\nJumlah Total: `{}`".format(
                mention_markdown(message.from_user.id,
                                 message.from_user.first_name),
                message.chat.title, text[:3500], len(MENTIONED)),
            reply_markup=button)
Esempio n. 10
0
async def afk_mentioned(_client, message):
    if not DB_AVAILABLE:
        return
    global MENTIONED
    get = get_afk()
    if get and get['afk']:
        if "-" in str(message.chat.id):
            cid = str(message.chat.id)[4:]
        else:
            cid = str(message.chat.id)

        if cid in list(AFK_RESTIRECT) and int(AFK_RESTIRECT[cid]) >= int(
                time.time()):
            return
        AFK_RESTIRECT[cid] = int(time.time()) + DELAY_TIME
        if get['reason']:
            await message.reply("Sorry, {} is AFK!\nBecause of {}".format(
                mention_markdown(Owner, OwnerName), get['reason']))
        else:
            await message.reply("Sorry, {} is AFK!".format(
                mention_markdown(Owner, OwnerName)))

        _, message_type = get_message_type(message)
        if message_type == Types.TEXT:
            text = message.text if message.text else message.caption
        else:
            text = message_type.name

        MENTIONED.append({
            "user": message.from_user.first_name,
            "user_id": message.from_user.id,
            "chat": message.chat.title,
            "chat_id": cid,
            "text": text,
            "message_id": message.message_id
        })
        button = InlineKeyboardMarkup([[
            InlineKeyboardButton("Go to message",
                                 url="https://t.me/c/{}/{}".format(
                                     cid, message.message_id))
        ]])
        await setbot.send_message(
            Owner,
            "{} mentioned you in {}\n\n{}\n\nTotal count: `{}`".format(
                mention_markdown(message.from_user.id,
                                 message.from_user.first_name),
                message.chat.title, text[:3500], len(MENTIONED)),
            reply_markup=button)
Esempio n. 11
0
async def get_list_bots(client, message):
    replyid = None
    if len(message.text.split()) >= 2:
        chat = message.text.split(None, 1)[1]
    else:
        chat = message.chat.id
    grup = await client.get_chat(chat)
    if message.reply_to_message:
        replyid = message.reply_to_message.message_id
    getbots = client.iter_chat_members(chat)
    bots = []
    async for a in getbots:
        try:
            nama = a.user.first_name + " " + a.user.last_name
        except:
            nama = a.user.first_name
        if nama is None:
            nama = tld('botlist_one')
        if a.user.is_bot:
            bots.append(mention_markdown(a.user.id, nama))
    teks = tld('botlist_two').format(grup.title)
    teks += tld('botlist_three')
    for x in bots:
        teks += "│ • {}\n".format(x)
    teks += tld('botlist_four').format(len(bots))
    if replyid:
        await client.send_message(message.chat.id,
                                  teks,
                                  reply_to_message_id=replyid)
    else:
        await edrep(message, text=teks)
Esempio n. 12
0
async def get_list_bots(client, message):
    replyid = None
    if len(message.text.split()) >= 2:
        chat = message.text.split(None, 1)[1]
    else:
        chat = message.chat.id
    grup = await client.get_chat(chat)
    if message.reply_to_message:
        replyid = message.reply_to_message.message_id
    getbots = client.iter_chat_members(chat)
    bots = []
    async for a in getbots:
        try:
            nama = a.user.first_name + " " + a.user.last_name
        except:
            nama = a.user.first_name
        if nama is None:
            nama = "☠️ Deleted account"
        if a.user.is_bot:
            bots.append(mention_markdown(a.user.id, nama))
    teks = "**All bots in group {}**\n".format(grup.title)
    teks += "╒═══「 Bots 」\n"
    for x in bots:
        teks += "│ • {}\n".format(x)
    teks += "╘══「 Total {} Bots 」".format(len(bots))
    if replyid:
        await client.send_message(message.chat.id,
                                  teks,
                                  reply_to_message_id=replyid)
    else:
        await msg(message, text=teks)
Esempio n. 13
0
async def afk(client, message):
    if len(message.text.split()) >= 2:
        set_afk(True, message.text.split(None, 1)[1])
        await message.edit("{} is now AFK!\nBecause of {}".format(
            mention_markdown(message.from_user.id,
                             message.from_user.first_name),
            message.text.split(None, 1)[1]))
        await setbot.send_message(
            Owner, "You are now AFK!\nBecause of {}".format(
                message.text.split(None, 1)[1]))
    else:
        set_afk(True, "")
        await message.edit("{} is now AFK!".format(
            mention_markdown(message.from_user.id,
                             message.from_user.first_name)))
        await setbot.send_message(Owner, "You are now AFK!")
    await message.stop_propagation()
Esempio n. 14
0
async def pm_button(client, query):
    print(query)
    if not PM_PERMIT:
        return
    if query.from_user.id in AdminSettings and not re.match("engine_pm_apr", query.data) and not re.match("engine_pm_blk", query.data):
        await client.answer_callback_query(query.id, "No, you can't click by yourself. REEEEEEEEEEE.", show_alert=False)
        return
    if re.match("engine_pm_block", query.data):
        await app.send_sticker(query.from_user.id, sticker='CAADAgAD1QQAAp7kTAry1JrL3zVXSxYE')
        await setbot.edit_inline_text(query.from_user.id, "Sorry, No cash. Also you are getting reported to **SpamWatch**, OwO.")
        await app.block_user(query.from_user.id)
    elif re.match("engine_pm_nope", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Hello, please wait for a reply from my master, thank you")
        buttons = InlineKeyboardMarkup([[InlineKeyboardButton("Approve",
                                                            callback_data=f"engine_pm_apr-{query.from_user.id}"),
                                        InlineKeyboardButton("Block",
                                                            callback_data=f"engine_pm_blk-{query.from_user.id}")]])
        pm_bot_mention = mention_markdown(query.from_user.id, query.from_user.first_name)
        pm_bot_message = f"[{OwnerName}](tg://user?id={Owner}), {pm_bot_mention} want to contact you~"
        await setbot.send_message(NOTIFY_ID, pm_bot_message,reply_markup=buttons)
        set_req(query.from_user.id, True)
    elif re.match("engine_pm_report", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Hello, if you want to report any bugs, please join @NanaBotSupport.")
    elif re.match("engine_pm_none", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Alright then,\nIf you want anything from me, please contact my again. Thank you")
    elif re.match("engine_pm_none", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id,
                            "Alright then, if you want anything from me, please contact my again. Thank you.")
    elif re.match("engine_pm_report_spam", query.data):
        await app.send_message(query.from_user.id,
                            "Alright, please wait for my master's response for next steps. Thanks for submitting your spam report.")
    elif re.match("engine_pm_fban_appeal", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.inline_message_id,
                            "Thanks for asking for a ban appeal. Please take that to @ThePinsTeam_FedSupport so other FedAdmins can take care of your case.\n\nIf you think you're banned on other places such as SpamWatch, please check their available support options first.")

    elif re.match("engine_pm_apr", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text(f"[Approved for PM]({target})")
        await app.send_message(target, "Hello, this is **Nana**, my master approved you to PM.")
        set_whitelist(int(target), True)
    elif re.match(r"engine_pm_blk", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text("Sed, that user was blocked.")
        await app.send_message(target, "Hello, this is **Nana**, my master has decide to block you. Sorry for this!")
        await app.block_user(target)
    else:
        await setbot.edit_inline_text(query.inline_message_id, "🙆‍")
Esempio n. 15
0
async def pm_button(client, query):
    print(query)
    if not PM_PERMIT:
        return
    if query.from_user.id in AdminSettings and not re.match("engine_pm_apr", query.data) and not re.match("engine_pm_blk", query.data):
        await client.answer_callback_query(query.id, "No, you can't click by yourself", show_alert=False)
        return
    if re.match("engine_pm_block", query.data):
        await app.send_sticker(query.from_user.id, sticker='CAADAgAD1QQAAp7kTAry1JrL3zVXSxYE')
        await setbot.edit_inline_text(query.from_user.id, "Sorry, No cash.\nAlso you are getting reported to **SpamWatch**, OwO")
        await app.block_user(query.from_user.id)
    elif re.match("engine_pm_nope", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Hello, please wait for a reply from my master, thank you")
        buttons = InlineKeyboardMarkup([[InlineKeyboardButton("Approve",
                                                            callback_data=f"engine_pm_apr-{query.from_user.id}"),
                                        InlineKeyboardButton("Block",
                                                            callback_data=f"engine_pm_blk-{query.from_user.id}")]])
        pm_bot_mention = mention_markdown(query.from_user.id, query.from_user.first_name)
        pm_bot_message = f"[{OwnerName}](tg://user?id={Owner}), {pm_bot_mention} want to contact you~"
        await setbot.send_message(NOTIFY_ID, pm_bot_message,reply_markup=buttons)
        set_req(query.from_user.id, True)
    elif re.match("engine_pm_report", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Hello, if you want to report any bugs, please vist in @NanaBotSupport")
    elif re.match("engine_pm_none", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(query.from_user.id, "Alright then,\nIf you want anything from me, please contact my again. Thank you")
    elif re.match("engine_pm_apr", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text(f"[Approved for PM]({target})")
        await app.send_message(target, "Hello, this is **Nana**, my master approved you to PM.")
        set_whitelist(int(target), True)
    elif re.match(r"engine_pm_blk", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text("That user was blocked ~")
        await app.send_message(target, "Hello, this is **Nana**, my master has decide to block you.\nSorry for this!")
        await app.block_user(target)
    else:
        await setbot.edit_inline_text(query.inline_message_id, "🙆‍")
Esempio n. 16
0
async def pm_button(client, query):
    if PM_PERMIT:
        if query.from_user.id in AdminSettings and not re.match(
                r"engine_pm_apr", query.data) and not re.match(
                    r"engine_pm_blk", query.data):
            await client.answer_callback_query(
                query.id, "No, you can't click by yourself", show_alert=False)
            return
        if re.match(r"engine_pm_block", query.data):
            await setbot.edit_inline_text(query.inline_message_id, "💩")
            await app.send_message(query.from_user.id,
                                   "Opps, no nudes for you")
            await app.block_user(query.from_user.id)
        elif re.match(r"engine_pm_nope", query.data):
            await setbot.edit_inline_text(query.inline_message_id, "👍")
            await app.send_message(
                query.from_user.id,
                "Hello, please wait for a reply from my master, thank you")
            buttons = InlineKeyboardMarkup([[
                InlineKeyboardButton(
                    "Approve",
                    callback_data=f"engine_pm_apr-{query.from_user.id}"),
                InlineKeyboardButton(
                    "Block",
                    callback_data=f"engine_pm_blk-{query.from_user.id}")
            ]])
            pm_bot_mention = mention_markdown(query.from_user.id,
                                              query.from_user.first_name)
            pm_bot_message = f"[{OwnerName}](tg://user?id={Owner}), {pm_bot_mention} want to contact you~"
            await setbot.send_message(NOTIFY_ID,
                                      pm_bot_message,
                                      reply_markup=buttons)
            set_req(query.from_user.id, True)
            from nana.modules.lydia import lydia_status
            if lydia_status:
                await app.send_message(
                    query.from_user.id,
                    "During the wait for permission from my master, why do not we have a little chat?"
                )
        elif re.match("engine_pm_report", query.data):
            await setbot.edit_inline_text(query.inline_message_id, "👍")
            await app.send_message(
                query.from_user.id,
                "Hello, if you want to report any bugs, please vist in @NanaBotSupport"
            )
        elif re.match("engine_pm_none", query.data):
            await setbot.edit_inline_text(query.inline_message_id, "👍")
            await app.send_message(
                query.from_user.id,
                "Alright then,\nIf you want anything from me, please contact my again. Thank you"
            )
        elif re.match("engine_pm_apr", query.data):
            target = query.data.split("-")[1]
            await query.message.edit_text(f"[Approved for PM]({target})")
            await app.send_message(
                target, "Hello, this is Nana, my master approved you to PM.")
            set_whitelist(int(target), True)
        elif re.match(r"engine_pm_blk", query.data):
            target = query.data.split("-")[1]
            await query.message.edit_text("That user was blocked~")
            await app.send_message(
                target,
                "Hello, this is Nana, my master has decide to block you.\nSorry for this!"
            )
            await app.block_user(target)
        else:
            await setbot.edit_inline_text(query.inline_message_id, "🙆‍")
    else:
        return
Esempio n. 17
0
async def pm_button(client, query):
    if query.from_user.id in AdminSettings and not re.match(
            r"engine_pm_apr", query.data) and not re.match(
                r"engine_pm_blk", query.data):
        await client.answer_callback_query(query.id,
                                           "No, you can't click by yourself",
                                           show_alert=False)
        return
    if re.match(r"engine_pm_block", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "💩")
        # await app.send_message(query.from_user.id, "I dont share any hack or any illegal things, if you PM me for this, then you are retard and does not have a brain.\nContact your admin and ask that illegal things, not me\n\nGood bye you f*****g retard!")
        await app.block_user(query.from_user.id)
    elif re.match(r"engine_pm_nope", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(
            query.from_user.id,
            "Hello, please wait for a reply from my master\nI've notify my master to reply your PM, thank you"
        )
        FromUser = mention_markdown(query.from_user.id,
                                    query.from_user.first_name)
        await setbot.send_message(
            NOTIFY_ID,
            "Hi [ {} ](tg://user?id={}), {} want to contact you~".format(
                OwnerName, Owner, FromUser),
            reply_markup=InlineKeyboardMarkup([[
                InlineKeyboardButton("Approve",
                                     callback_data="engine_pm_apr-{}".format(
                                         query.from_user.id)),
                InlineKeyboardButton("Block",
                                     callback_data="engine_pm_blk-{}".format(
                                         query.from_user.id))
            ]]))
        set_req(query.from_user.id, True)
        from nana.modules.lydia import lydia_status
        if lydia_status:
            await app.send_message(
                query.from_user.id,
                "During the wait for permission from my master, why do not we have a little chat?"
            )
    elif re.match(r"engine_pm_report", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(
            query.from_user.id,
            "Hello, if you want to report any bugs for my bots, please report in @NanaBotSupport\nThank you"
        )
    elif re.match(r"engine_pm_none", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "👍")
        await app.send_message(
            query.from_user.id,
            "Alright then,\nIf you want anything from me, please contact my again. Thank you"
        )
    elif re.match(r"engine_pm_donate", query.data):
        await setbot.edit_inline_text(query.inline_message_id, "❤️")
        await app.send_message(
            query.from_user.id,
            "Cool, thank you for donate me\nYou can select payment in here https://ayrahikari.github.io/donations.html\n\nIf you've donated me, please PM me again, thanks"
        )
    elif re.match(r"engine_pm_apr", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text("[Approved for PM]({})".format(target))
        await app.send_message(
            target, "Hello, this is Nana, my master approved you to PM.")
        set_whitelist(int(target), True)
    elif re.match(r"engine_pm_blk", query.data):
        target = query.data.split("-")[1]
        await query.message.edit_text("That user was blocked~")
        await app.send_message(
            target,
            "Hello, this is Nana, my master has decide to block you.\nSorry for this!"
        )
        await app.block_user(target)
    else:
        await setbot.edit_inline_text(query.inline_message_id, "🙆‍♀️")