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 edrep(message, text=f"Sorry, {mention_markdown(Owner, OwnerName)} is AFK!\nBecause of {get['reason']}") else: await edrep(message, text=f"Sorry, {mention_markdown(Owner, OwnerName)} is AFK!") _, 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)
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})"))
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)
async def no_longer_afk(client, message): if not DB_AVAIABLE: return global MENTIONED get = get_afk() if get and get['afk']: await client.send_message(message.from_user.id, "You are no longer afk!") set_afk(False, "") text = "You are no longer afk!\n**Total {} mentioned you**\n".format(len(MENTIONED)) for x in MENTIONED: msg_text = x["text"] if len(msg_text) >= 11: msg_text = "{}...".format(x["text"]) text += "- [{}](https://t.me/c/{}/{}) ({}): {}\n".format(escape_markdown(x["user"]), x["chat_id"], x["message_id"], x["chat"], msg_text) await client.send_message(Owner, text) MENTIONED = []
async def no_longer_afk(client, message): global MENTIONED get = get_afk() if get and get['afk']: await setbot.send_message(message.from_user.id, "Yeay! Sekarang kamu sudah tidak AFK!") set_afk(False, "") text = "**Total {} menyebutmu**\n".format(len(MENTIONED)) for x in MENTIONED: msg_text = x["text"] if len(msg_text) >= 11: msg_text = "{}...".format(x["text"]) text += "- [{}](https://t.me/c/{}/{}) ({}): {}\n".format( escape_markdown(x["user"]), x["chat_id"], x["message_id"], x["chat"], msg_text) await setbot.send_message(message.from_user.id, text) MENTIONED = []