|
@ -257,11 +257,12 @@ class Callbacks(object): |
|
|
answer = await self.bot.text_ai.generate_sync(full_prompt, self.bot.runpod_api_key, self.bot, typing) |
|
|
answer = await self.bot.text_ai.generate_sync(full_prompt, self.bot.runpod_api_key, self.bot, typing) |
|
|
answer = answer.strip() |
|
|
answer = answer.strip() |
|
|
await self.client.room_typing(room.room_id, False) |
|
|
await self.client.room_typing(room.room_id, False) |
|
|
if not (self.bot.translate is None): |
|
|
if (self.bot.translate is None) or (self.bot.translate == "en"): |
|
|
|
|
|
await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id) |
|
|
|
|
|
else: |
|
|
translated_answer = translate.translate(answer, "en", self.bot.translate) |
|
|
translated_answer = translate.translate(answer, "en", self.bot.translate) |
|
|
await self.bot.send_message(self.client, room.room_id, translated_answer, reply_to=chat_message.event_id, original_message=answer) |
|
|
await self.bot.send_message(self.client, room.room_id, translated_answer, reply_to=chat_message.event_id, original_message=answer) |
|
|
else: |
|
|
|
|
|
await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id) |
|
|
|
|
|
if not "message_count" in self.bot.room_config[room.room_id]: |
|
|
if not "message_count" in self.bot.room_config[room.room_id]: |
|
|
self.bot.room_config[room.room_id]["message_count"] = 0 |
|
|
self.bot.room_config[room.room_id]["message_count"] = 0 |
|
|
self.bot.room_config[room.room_id]["message_count"] += 1 |
|
|
self.bot.room_config[room.room_id]["message_count"] += 1 |
|
|