Answer the question
In order to leave comments, you need to log in
How to change the name of a conversation after a certain period of time?
It is necessary to change the name of the conversation once a day.
It turned out something like this, but not what you need.
setInterval(function(){
vk.updates.on('message', async (context) => {
await vk.api.messages.editChat({
chat_id: 3,
title: (`test`)
})});
}, 1000);
Answer the question
In order to leave comments, you need to log in
Would this option work?
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();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question