Fix messages deletion for poe

This commit is contained in:
SillyLossy
2023-04-04 12:35:43 +03:00
parent 3eb9fa975c
commit 2ab42f40f7
2 changed files with 3 additions and 3 deletions

4
poe.js
View File

@ -376,7 +376,7 @@ class Client {
async purge_conversation(chatbot, count = -1) { async purge_conversation(chatbot, count = -1) {
logger.info(`Purging messages from ${chatbot}`); logger.info(`Purging messages from ${chatbot}`);
let last_messages = (await this.get_message_history(chatbot, count = 50)).reverse(); let last_messages = (await this.get_message_history(chatbot, 50)).reverse();
while (last_messages.length) { while (last_messages.length) {
const message_ids = []; const message_ids = [];
for (const message of last_messages) { for (const message of last_messages) {
@ -392,7 +392,7 @@ class Client {
if (count === 0) { if (count === 0) {
return; return;
} }
last_messages = (await this.get_message_history(chatbot, count = 50)).reverse(); last_messages = (await this.get_message_history(chatbot, 50)).reverse();
} }
logger.info("No more messages left to delete."); logger.info("No more messages left to delete.");
} }

View File

@ -1652,7 +1652,7 @@ app.post('/purge_poe', jsonParser, async (request, response) => {
try { try {
const client = await getPoeClient(token); const client = await getPoeClient(token);
await client.purge_conversation(bot, count) await client.purge_conversation(bot, count);
client.disconnect_ws(); client.disconnect_ws();
return response.send({"ok" : true}); return response.send({"ok" : true});