|
1 | 1 | import { GroupChat, Message } from "whatsapp-web.js"; |
2 | 2 | import { promptTracker } from "../clients/prompt"; |
3 | | -import { sydney } from "../clients/sydney"; |
| 3 | +import { idsCache, sydney } from "../clients/sydney"; |
4 | 4 | import { config } from "../config"; |
5 | 5 | import { getAvailableTones, react } from "../utils"; |
6 | 6 | import { reminderDB, reminders } from "./reminder"; |
@@ -40,14 +40,24 @@ export async function handleCommand( |
40 | 40 | }); |
41 | 41 |
|
42 | 42 | if (admins.includes(message.author)) { |
43 | | - await sydney.conversationsCache.delete(chat.id._serialized); |
| 43 | + console.log("admins:", admins); |
| 44 | + let onGoingConversation = await idsCache.get(chat.id._serialized); |
| 45 | + const conversationData = JSON.parse(onGoingConversation); |
| 46 | + let jailbreakId = conversationData.jailbreakConversationId; |
| 47 | + console.log("jailbreakId:", jailbreakId); |
| 48 | + await sydney.conversationsCache.delete(jailbreakId); |
| 49 | + await idsCache.delete(chat.id._serialized); |
44 | 50 | await message.reply("Conversation history reset."); |
45 | 51 | } else { |
46 | 52 | await message.reply("You are not allowed to perform this command."); |
47 | 53 | } |
48 | 54 | break; |
49 | 55 | } else { |
50 | | - await sydney.conversationsCache.delete(chat.id._serialized); |
| 56 | + let onGoingConversation = await idsCache.get(chat.id._serialized); |
| 57 | + const conversationData = JSON.parse(onGoingConversation); |
| 58 | + let jailbreakId = conversationData.jailbreakConversationId; |
| 59 | + await idsCache.delete(chat.id._serialized); |
| 60 | + await sydney.conversationsCache.delete(jailbreakId); |
51 | 61 | await message.reply("Conversation history reset."); |
52 | 62 | break; |
53 | 63 | } |
|
0 commit comments