randydev commited on
Commit
f289835
·
verified ·
1 Parent(s): c1ece7f

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +22 -1
chatbot/plugins/chat.py CHANGED
@@ -50,6 +50,8 @@ async def geni_files_delete(name: str):
50
  return None
51
  return response.text
52
 
 
 
53
  DISABLE_COMMAND = [
54
  "start",
55
  "status",
@@ -77,6 +79,14 @@ I am ready to be a gemini bot developer
77
  - Command: /offchat (pm or group)
78
  """
79
 
 
 
 
 
 
 
 
 
80
  @Client.on_message(
81
  ~filters.scheduled
82
  & filters.command(["start"])
@@ -311,12 +321,23 @@ async def chatbot_talk(client: Client, message: Message):
311
  return await ai_reply.edit_text(f"Error: {e}")
312
 
313
  if message.video:
 
314
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_VIDEO)
315
  await asyncio.sleep(1.5)
 
 
 
 
 
 
 
316
  if client.me.is_premium:
317
  ai_reply = await message.reply_text(f"{custom_loading}Processing...")
318
  else:
319
- ai_reply = await message.reply_text(f"Processing...")
 
 
 
320
  video_file_name = await message.download(file_name="newvideo.mp4")
321
  caption = message.caption or "What's this?"
322
  model = genai.GenerativeModel(
 
50
  return None
51
  return response.text
52
 
53
+ spam_chats = []
54
+
55
  DISABLE_COMMAND = [
56
  "start",
57
  "status",
 
79
  - Command: /offchat (pm or group)
80
  """
81
 
82
+ @Client.on_callback_query(filters.regex("^cancels"))
83
+ def cancel_(client, callback_query):
84
+ try:
85
+ spam_chats.clear()
86
+ await callback_query.edit_message_text("ok cancel")
87
+ except Exception as e:
88
+ await callback_query.answer(f"Nothing cancel: {e}")
89
+
90
  @Client.on_message(
91
  ~filters.scheduled
92
  & filters.command(["start"])
 
321
  return await ai_reply.edit_text(f"Error: {e}")
322
 
323
  if message.video:
324
+ spam_chats.append(message.chat.id)
325
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_VIDEO)
326
  await asyncio.sleep(1.5)
327
+ buttons = [
328
+ [
329
+ InlineKeyboardButton(
330
+ text="Cancel",
331
+ callback_data="cancels"
332
+ ),
333
+ ],
334
  if client.me.is_premium:
335
  ai_reply = await message.reply_text(f"{custom_loading}Processing...")
336
  else:
337
+ ai_reply = await message.reply_text(
338
+ f"Processing...\n\nYou can use stop everything",
339
+ reply_markup=InlineKeyboardMarkup(buttons)
340
+ )
341
  video_file_name = await message.download(file_name="newvideo.mp4")
342
  caption = message.caption or "What's this?"
343
  model = genai.GenerativeModel(