Handle creation of chats with groups, closes #7
This commit is contained in:
parent
0d0a98490c
commit
fd02432559
14
src/vk.ts
14
src/vk.ts
|
@ -100,6 +100,7 @@ export class VkPuppet {
|
|||
name: `${userInfo[0].first_name} ${userInfo[0].last_name}`,
|
||||
avatarUrl: userInfo[0].photo_max,
|
||||
isDirect: true,
|
||||
externalUrl: `https://vk.com/id${info.items[0].peer.id}}`,
|
||||
};
|
||||
break;
|
||||
|
||||
|
@ -113,6 +114,17 @@ export class VkPuppet {
|
|||
};
|
||||
break;
|
||||
|
||||
case "group":
|
||||
const groupInfo = await p.client.api.groups.getById({ group_id: info.items[0].peer.id });
|
||||
response = {
|
||||
puppetId,
|
||||
roomId: peerId.toString(),
|
||||
name: groupInfo[0].name || peerId.toString(),
|
||||
avatarUrl: groupInfo[0]?.photo_200,
|
||||
externalUrl: `https://vk.com/${groupInfo[0].screen_name}`,
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
response = {
|
||||
puppetId,
|
||||
|
@ -521,7 +533,7 @@ export class VkPuppet {
|
|||
}
|
||||
if (context.hasAttachments()) {
|
||||
const attachments = p.data.isUserToken
|
||||
? (await p.client.api.messages.getById({message_ids: context.id})).items[0].attachments!
|
||||
? (await p.client.api.messages.getById({ message_ids: context.id })).items[0].attachments!
|
||||
: context.attachments;
|
||||
for (const f of attachments) {
|
||||
switch (f.type) {
|
||||
|
|
Loading…
Reference in a new issue