randydev commited on
Commit
76c6786
·
verified ·
1 Parent(s): 6081689

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +27 -0
chatbot/plugins/chat.py CHANGED
@@ -1444,6 +1444,33 @@ async def chatbot_talk(client: Client, message: Message):
1444
  return
1445
 
1446
  if check_is_system.get("is_system", False):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1447
  test_result = ""
1448
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
1449
  backup_chat.append({"role": "user", "parts": [{"text": query_base}]})
 
1444
  return
1445
 
1446
  if check_is_system.get("is_system", False):
1447
+ _deletemydata_match = re.match(r"^--deletemydata\s+--reason\s+(.+)$", query_base, re.IGNORECASE)
1448
+ if _deletemydata_match:
1449
+ reasons = _deletemydata_match.group(1).strip()
1450
+ if not reasons:
1451
+ return await message.reply_text("Reason cannot be empty")
1452
+ if len(reasons) < 15:
1453
+ return await message.reply_text("Reason is too short (minimum 15 characters).")
1454
+ buttons = [
1455
+ [
1456
+ InlineKeyboardButton(
1457
+ text="💀 Delete my data history",
1458
+ callback_data="deletemydatagm"
1459
+ )
1460
+ ],
1461
+ [
1462
+ InlineKeyboardButton(
1463
+ text="❌ Cancel",
1464
+ callback_data="closedd"
1465
+ )
1466
+ ]
1467
+ ]
1468
+ await message.reply_text(
1469
+ "Are you sure you want to delete this data history?",
1470
+ reply_markup=InlineKeyboardMarkup(buttons)
1471
+ )
1472
+ return
1473
+
1474
  test_result = ""
1475
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
1476
  backup_chat.append({"role": "user", "parts": [{"text": query_base}]})