Answer the question
In order to leave comments, you need to log in
How to send Base64 VK vkio?
I'm interested in answering questions about how to send a base64 image to VK
. The fact is that I tried to google my question, but did not find a normal answer that would help me, although there were solutions ...
const { VK } = require("vk-io");
const { HearManager } = require("@vk-io/hear");
const vk = new VK({
token: "токен группы"
});
const bot = new HearManager();
vk.updates.on("message_new", bot.middleware);
bot.hear(/test/i, async (msg) => {
// вот картинка base64 которую нужно отправить
const baseImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAB0CAYAAABUmhYnAAAAAklEQVR4AewaftIAAAK+SURBVO3BQW7kQAwEwSxC//9yro88NSBI4/UQjIg/WGMUa5RijVKsUYo1SrFGKdYoxRqlWKMUa5RijVKsUYo1SrFGKdYoxRrl4qEk/CaVkyScqNyRhN+k8kSxRinWKMUa5eJlKm9KwkkSTlTepPKmJLypWKMUa5RijXLxYUm4Q+UOlS4JJ0k4UbkjCXeofFKxRinWKMUa5WIYlS4JJyqTFGuUYo1SrFEuvlwSTlROktCpfLNijVKsUYo1ysWHqXySyv+k8pcUa5RijVKsUS5eloTflIROpUtCp/JEEv6yYo1SrFGKNUr8wWBJuEPlmxVrlGKNUqxRLh5KQqfSJaFT6ZLQqXRJ6FROktCpdEnoVJ5IQqdykoRO5U3FGqVYoxRrlIuHVN6UhE7lDpUuCZ3KHUnoVDqVJ5LQqTxRrFGKNUqxRrl4WRI6lS4JncpJEjqVLglPJKFT6VROkvCXFGuUYo1SrFHiDx5IwonKSRI6lb8kCZ3KE0noVN5UrFGKNUqxRrl4SKVLQpeETuWOJJyonCShU+mS0KnckYRO5UTlk4o1SrFGKdYo8QdfLAlPqHRJ6FS6JHQqJ0m4Q+WJYo1SrFGKNcrFQ0n4TSqdykkSnkjCNynWKMUapVijXLxM5U1J+KQknKh0SeiS0Kl0Kr+pWKMUa5RijXLxYUm4Q+WOJHQqd6h0SeiScKJyRxJOVJ4o1ijFGqVYo1x8OZUuCZ3KHSpdEp5IwonKm4o1SrFGKdYoF18uCSdJ6FS6JHQqncpJEjqVE5UuCZ3KE8UapVijFGuUiw9T+SSVLgmdyonKSRI6lTtUuiR0Km8q1ijFGqVYo1y8LAm/KQknSehUuiR0KidJ6FSeSEKn8kSxRinWKMUaJf5gjVGsUYo1SrFGKdYoxRqlWKMUa5RijVKsUYo1SrFGKdYoxRqlWKMUa5R/UIUZ63ue2EIAAAAASUVORK5CYII=";
});
vk.updates.start().catch(console.error);
Answer the question
In order to leave comments, you need to log in
https://github.com/negezor/vk-io/blob/master/docs/...
according to the documentation the upload method does not support base64
if possible, you should consider deprecating base64
if this is not possible, there is always a possibility
const buf = Buffer.from(b64string, 'base64');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question