Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(({ response, $store }) => {
if (isError(response)) {
throw new Error(`[TDLib][${response.code}] ${response.message}`)
}
const chats = response.chatIds.map((chatId) => {
const chat = $store.chats.get(chatId)
const message = $store.chatLastMessage.get(chatId)
if (!chat || !message || !message.lastMessage) {
throw new Error('Invalidate store')
}
const { lastMessage } = message
const { title } = chat
const sentBy = $store.users.get(lastMessage.senderUserId)
return {
title,
}).then(({ request, response }) => {
if (isError(response)) {
writeError(`[${request.method}][${response.code}] ${response.message}`)
} else {
writeInfo('Profile photo has been loaded.')
}
})