def remove_chat(update: Update, context: CallbackContext): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("AI isn't enabled here in the first place!") else: sql.rem_chat(chat.id) msg.reply_text("AI disabled successfully!")
def list_chatbot_chats(update: Update, context: CallbackContext): chats = sql.get_all_chats() text = "<b>AI-Enabled Chats</b>\n" for chat in chats: try: x = context.bot.get_chat(int(*chat)) name = x.title if x.title else x.first_name text += f"• <code>{name}</code>\n" except BadRequest: sql.rem_chat(*chat) except Unauthorized: sql.rem_chat(*chat) except RetryAfter as e: sleep(e.retry_after) update.effective_message.reply_text(text, parse_mode="HTML")
def remove_chat(bot: Bot, update: Update): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("AI isn't enabled here in the first place!") return "" else: sql.rem_chat(chat.id) msg.reply_text("AI disabled successfully!") message = (f"<b>{html.escape(chat.title)}:</b>\n" f"#AI_DISABLED\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n") return message
def remove_chat(bot: Bot, update: Update): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("AI burada en başta etkin değil!") return "" else: sql.rem_chat(chat.id) msg.reply_text("AI başarıyla devre dışı bırakıldı!") message = (f"<b>{html.escape(chat.title)}:</b>\n" f"#AI_DISABLED\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n") return message
def list_chatbot_chats(bot: Bot, update: Update): chats = sql.get_all_chats() text = "<b>AI Etkin Sohbetler</b>\n" for chat in chats: try: x = bot.get_chat(int(*chat)) name = x.title if x.title else x.first_name text += f"• <code>{name}</code>\n" except BadRequest: sql.rem_chat(*chat) except Unauthorized: sql.rem_chat(*chat) except RetryAfter as e: sleep(e.retry_after) update.effective_message.reply_text(text, parse_mode="HTML")
def remove_chat(update: Update, context: CallbackContext): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("AI haven't enabled here!") return "" else: sql.rem_chat(chat.id) msg.reply_text("AI Deactivated successfully!") message = ( f"<b>{html.escape(chat.title)}:</b>\n" f"#AI_DISABLED\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" ) return message
def remove_chat(update: Update, context: CallbackContext): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("Chatbot tidak diaktifkan disini sejak awal!") return "" else: sql.rem_chat(chat.id) msg.reply_text("Sukses me-nonaktikan chatbot!") message = ( f"<b>{html.escape(chat.title)}:</b>\n" f"#Chatbot_Dimatikan\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" ) return message
def remove_chat(update: Update, context: CallbackContext): msg = update.effective_message chat = update.effective_chat user = update.effective_user is_chat = sql.is_chat(chat.id) if not is_chat: msg.reply_text("AI burada aktiv edilməyib!") return "" else: sql.rem_chat(chat.id) msg.reply_text("AI deaktiv edildi!") message = ( f"<b>{html.escape(chat.title)}:</b>\n" f"#AI_DISABLED\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" ) return message