Merge pull request #12 from MurzNN/fix-attachments

Refactored image url search, fixed url for link attachments
This commit is contained in:
Inex Code 2021-06-21 17:59:14 +03:00 committed by GitHub
commit 3ff0d8429d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -573,7 +573,7 @@ export class VkPuppet {
} }
} catch (err) { } catch (err) {
const opts: IMessageEvent = { const opts: IMessageEvent = {
body: `Image was sent: ${f["largeSizeUrl"]}`, body: `Image: ${f["image"]["largeSizeUrl"]}`,
}; };
await this.puppet.sendMessage(params, opts); await this.puppet.sendMessage(params, opts);
} }
@ -585,7 +585,7 @@ export class VkPuppet {
: await this.puppet.sendFileDetect(params, f["imagesWithBackground"][4]["url"]); : await this.puppet.sendFileDetect(params, f["imagesWithBackground"][4]["url"]);
} catch (err) { } catch (err) {
const opts: IMessageEvent = { const opts: IMessageEvent = {
body: `Sticker was sent: ${f["imagesWithBackground"][4]["url"]}`, body: `Sticker: ${f["imagesWithBackground"][4]["url"]}`,
}; };
await this.puppet.sendMessage(params, opts); await this.puppet.sendMessage(params, opts);
} }
@ -596,7 +596,7 @@ export class VkPuppet {
await this.puppet.sendAudio(params, f["oggUrl"]); await this.puppet.sendAudio(params, f["oggUrl"]);
} catch (err) { } catch (err) {
const opts: IMessageEvent = { const opts: IMessageEvent = {
body: `Audio message was sent: ${f["url"]}`, body: `Audio message: ${f["url"]}`,
}; };
await this.puppet.sendMessage(params, opts); await this.puppet.sendMessage(params, opts);
} }
@ -607,7 +607,7 @@ export class VkPuppet {
await this.puppet.sendAudio(params, f["url"]); await this.puppet.sendAudio(params, f["url"]);
} catch (err) { } catch (err) {
const opts: IMessageEvent = { const opts: IMessageEvent = {
body: `Music was sent: ${f["title"]} by ${f["artist"]} ${f["url"]}`, body: `Audio: ${f["title"]} by ${f["artist"]} ${f["url"]}`,
}; };
await this.puppet.sendMessage(params, opts); await this.puppet.sendMessage(params, opts);
} }
@ -619,7 +619,7 @@ export class VkPuppet {
: await this.puppet.sendFileDetect(params, f["url"], f["title"]); : await this.puppet.sendFileDetect(params, f["url"], f["title"]);
} catch (err) { } catch (err) {
const opts: IMessageEvent = { const opts: IMessageEvent = {
body: `Document was sent: ${f["url"]}`, body: `Document: ${f["url"]}`,
}; };
await this.puppet.sendMessage(params, opts); await this.puppet.sendMessage(params, opts);
} }
@ -627,7 +627,7 @@ export class VkPuppet {
case AttachmentType.LINK: case AttachmentType.LINK:
await this.puppet.sendMessage(params, { await this.puppet.sendMessage(params, {
body: `Link was sent: ${f["url"]}`, body: `Link: ${f["link"]["url"]}`,
}); });
break; break;