randydev commited on
Commit
bd49c1e
·
verified ·
1 Parent(s): d5c0a21

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +13 -7
chatbot/plugins/chat.py CHANGED
@@ -66,7 +66,8 @@ You are my name Akeno AI and python language powered by @xtdevs on telegram supp
66
  DISABLE_COMMAND = [
67
  "start",
68
  "offchat",
69
- "onchat"
 
70
  ]
71
 
72
  GEMINI_START_TEXT = """
@@ -122,19 +123,23 @@ async def rmchatbot_user(client: Client, message: Message):
122
  & filters.command(["ask"])
123
  & ~filters.forwarded
124
  )
125
- async def rmchatbot_user(client: Client, message: Message):
126
- chat_user = await db.get_chatbot(message.chat.id)
 
127
  if not chat_user:
128
  return
129
- query = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
130
-
131
- pro = await message.reply("Processing your request...", quote=True)
 
 
 
132
  await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
133
  await asyncio.sleep(1.5)
134
  try:
135
  backup_chat = await db._get_openai_chat_from_db(message.from_user.id)
136
  backup_chat.append({"role": "system", "content": BASE_PROMPT})
137
- backup_chat.append({"role": "user", "content": query_base})
138
  response = await akeno.OpenAI.run(
139
  ...,
140
  openai_meta=openai,
@@ -178,6 +183,7 @@ async def rmchatbot_user(client: Client, message: Message):
178
  | filters.regex(r"\b(Randy|Rendi)\b(.*)", flags=re.IGNORECASE)
179
  )
180
  & (filters.private | filters.group)
 
181
  & ~filters.command(DISABLE_COMMAND)
182
  & ~filters.bot
183
  & ~filters.via_bot
 
66
  DISABLE_COMMAND = [
67
  "start",
68
  "offchat",
69
+ "onchat",
70
+ "ask"
71
  ]
72
 
73
  GEMINI_START_TEXT = """
 
123
  & filters.command(["ask"])
124
  & ~filters.forwarded
125
  )
126
+ async def askcmd(client: Client, message: Message):
127
+ pro = await message.reply("Processing your request...", quote=True)
128
+ chat_user = await db.get_chatbot(message.chat.id)
129
  if not chat_user:
130
  return
131
+ if len(message.command) > 1:
132
+ prompt = message.text.split(maxsplit=1)[1]
133
+ elif message.reply_to_message:
134
+ prompt = message.reply_to_message.text
135
+ else:
136
+ return await pro.edit_text("Give ask from GPT-5")
137
  await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
138
  await asyncio.sleep(1.5)
139
  try:
140
  backup_chat = await db._get_openai_chat_from_db(message.from_user.id)
141
  backup_chat.append({"role": "system", "content": BASE_PROMPT})
142
+ backup_chat.append({"role": "user", "content": prompt})
143
  response = await akeno.OpenAI.run(
144
  ...,
145
  openai_meta=openai,
 
183
  | filters.regex(r"\b(Randy|Rendi)\b(.*)", flags=re.IGNORECASE)
184
  )
185
  & (filters.private | filters.group)
186
+ & filters.reply
187
  & ~filters.command(DISABLE_COMMAND)
188
  & ~filters.bot
189
  & ~filters.via_bot