setInterval(function(){
vk.updates.on('message', async (context) => {
await vk.api.messages.editChat({
chat_id: 3,
title: (`test`)
})});
}, 1000);
const conversations = new Map([
[3, 'test']
]);
async function updateChatTitle() {
for (const [chatId, title] of conversations) {
try {
await vk.api.messages.editChat({
chat_id: chatId,
title: title
});
} catch (error) {
console.error(`Could not update conversation name ${chatId}`, error);
}
}
setTimeout(updateChatTitle, 1000);
}
updateChatTitle();