You can't scan a qr code?, use this snippet, this snippet automatically transforms your qr code in discord, just use !qr [file image qr] or [link to image qr] , (you can change the prefix in the trigger event) NOTE: Requests may take a while because the QR is being searched
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const urlencode = require('urlencode');
const axios = require('axios');
try{
if(context.params.event.attachments[0]){ //If the content of the message has an attachment (image, file, etc.) do this
let encodeattachment = urlencode(context.params.event.attachments[0].url);
const convertattachment = await axios(
`https://api.qrserver.com/v1/read-qr-code/?fileurl=${encodeattachment}`
).then((res) => res.data);
let resultattachment = convertattachment[0].symbol[0].data;
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `✅|Here is the result of the QR!: \n${resultattachment}`,
});
}
else{ //If the content of the message has NOT an attachment (image, file, etc.) do this
let encodeurl = urlencode(context.params.event.content.split(' ')[1]);
const converturl = await axios(
`https://api.qrserver.com/v1/read-qr-code/?fileurl=${encodeurl}`
).then((res) => res.data);
let resulturl = converturl[0].symbol[0].data;
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `✅| Here is the result of the QR!: \n${resulturl}`,
});
}
}catch (e) { //If an error occurs in all the above code do this
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `❌| QR Error: No results found, please try again`
});
}