randydev commited on
Commit
365d344
1 Parent(s): 0913c1e

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +8 -44
chatbot/plugins/chat.py CHANGED
@@ -48,14 +48,6 @@ async def geni_files_delete(name: str):
48
  return None
49
  return response.text
50
 
51
-
52
- USER_TRACK = """
53
- • Chatbot ai Dev
54
-
55
- UserID: {user_id}
56
- First Name: {first_name}
57
- """
58
-
59
  @Client.on_message(
60
  filters.incoming
61
  & (
@@ -101,13 +93,6 @@ async def chatbot_talk(client: Client, message: Message):
101
  os.remove("chat.txt")
102
  else:
103
  await ai_reply.edit_text(response_reads)
104
- await client.send_message(
105
- -1002290885889,
106
- USER_TRACK.format(
107
- user_id=message.from_user.id if message.from_user else 0,
108
- first_name=message.from_user.first_name
109
- )
110
- )
111
  backup_chat.append({"role": "model", "parts": [{"text": response_reads}]})
112
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
113
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
@@ -115,8 +100,8 @@ async def chatbot_talk(client: Client, message: Message):
115
  return
116
  except InvalidArgument as e:
117
  return await ai_reply.edit_text(f"Error: {e}")
118
- except Exception:
119
- pass
120
 
121
  if message.audio or message.voice:
122
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_AUDIO)
@@ -169,13 +154,6 @@ async def chatbot_talk(client: Client, message: Message):
169
  os.remove("chat.txt")
170
  else:
171
  await ai_reply.edit_text(response.text)
172
- await client.send_message(
173
- -1002290885889,
174
- USER_TRACK.format(
175
- user_id=message.from_user.id if message.from_user else 0,
176
- first_name=message.from_user.first_name
177
- )
178
- )
179
  backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
180
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
181
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
@@ -184,8 +162,8 @@ async def chatbot_talk(client: Client, message: Message):
184
  return
185
  except InvalidArgument as e:
186
  return await ai_reply.edit_text(f"Error: {e}")
187
- except Exception:
188
- pass
189
 
190
  if message.video:
191
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_VIDEO)
@@ -235,13 +213,6 @@ async def chatbot_talk(client: Client, message: Message):
235
  os.remove("chat.txt")
236
  else:
237
  await ai_reply.edit_text(response.text)
238
- await client.send_message(
239
- -1002290885889,
240
- USER_TRACK.format(
241
- user_id=message.from_user.id if message.from_user else 0,
242
- first_name=message.from_user.first_name,
243
- )
244
- )
245
  backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
246
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
247
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
@@ -250,8 +221,8 @@ async def chatbot_talk(client: Client, message: Message):
250
  return
251
  except InvalidArgument as e:
252
  return await ai_reply.edit_text(f"Error: {e}")
253
- except Exception:
254
- pass
255
 
256
  if message.text:
257
  await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
@@ -285,16 +256,9 @@ async def chatbot_talk(client: Client, message: Message):
285
  os.remove("chat.txt")
286
  else:
287
  await message.reply_text(output)
288
- await client.send_message(
289
- -1002290885889,
290
- USER_TRACK.format(
291
- user_id=message.from_user.id if message.from_user else 0,
292
- first_name=message.from_user.first_name
293
- )
294
- )
295
  backup_chat.append({"role": "model", "parts": [{"text": output}]})
296
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
297
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
298
  return
299
- except Exception:
300
- pass
 
48
  return None
49
  return response.text
50
 
 
 
 
 
 
 
 
 
51
  @Client.on_message(
52
  filters.incoming
53
  & (
 
93
  os.remove("chat.txt")
94
  else:
95
  await ai_reply.edit_text(response_reads)
 
 
 
 
 
 
 
96
  backup_chat.append({"role": "model", "parts": [{"text": response_reads}]})
97
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
98
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
 
100
  return
101
  except InvalidArgument as e:
102
  return await ai_reply.edit_text(f"Error: {e}")
103
+ except Exception as e:
104
+ return await ai_reply.edit_text(f"Error: {e}")
105
 
106
  if message.audio or message.voice:
107
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_AUDIO)
 
154
  os.remove("chat.txt")
155
  else:
156
  await ai_reply.edit_text(response.text)
 
 
 
 
 
 
 
157
  backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
158
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
159
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
 
162
  return
163
  except InvalidArgument as e:
164
  return await ai_reply.edit_text(f"Error: {e}")
165
+ except Exception as e:
166
+ return await ai_reply.edit_text(f"Error: {e}")
167
 
168
  if message.video:
169
  await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_VIDEO)
 
213
  os.remove("chat.txt")
214
  else:
215
  await ai_reply.edit_text(response.text)
 
 
 
 
 
 
 
216
  backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
217
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
218
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
 
221
  return
222
  except InvalidArgument as e:
223
  return await ai_reply.edit_text(f"Error: {e}")
224
+ except Exception as e:
225
+ return await ai_reply.edit_text(f"Error: {e}")
226
 
227
  if message.text:
228
  await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
 
256
  os.remove("chat.txt")
257
  else:
258
  await message.reply_text(output)
 
 
 
 
 
 
 
259
  backup_chat.append({"role": "model", "parts": [{"text": output}]})
260
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
261
  await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
262
  return
263
+ except Exception as e:
264
+ return await message.reply_text(f"Error: {e}")