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();
hearCommand('test', (context) => {});
// Аналогична данной запись
vk.updates.hear(
[
(text, { state }) => (
state.command === 'test'
),
'/test'
],
(context) => {}
);
hearCommand('test', /test (.+)/i, (context) => {});
// Аналогична данной запись
vk.updates.hear(
[
(text, { state }) => (
state.command === 'test'
),
/test (.+)/i
],
(context) => {}
);
const posts = [{ id: 0, message: 'foo', author: 0 }]
const users = [{ id: 0, name: 'bar', posts: [0] }]
const resolvers = {
User: {
posts({ id }) {
return posts.filter(post => (
post.author === id
))
}
},
Post: {
author({ author }) {
return users.find(user => (
user.id === author
))
}
},
posts() {
return posts;
},
users() {
return users;
}
};