UNPKG

koishi-plugin-beatsaber-bot

Version:

一个 用于 BeatSaber 的 koishi Bot 插件

43 lines (42 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const styled_qr_code_node_1 = require("@loskir/styled-qr-code-node"); async function createQrcode(url, width = 300, height = 300) { const options = { width: width ?? 300, height: height ?? 300, type: 'canvas', data: url, margin: 0, qrOptions: { typeNumber: 0, mode: 'Byte', errorCorrectionLevel: 'Q' }, imageOptions: { hideBackgroundDots: true, imageSize: 0.2, margin: 10, crossOrigin: 'anonymous', }, dotsOptions: { color: '#ffffff', type: 'rounded' }, backgroundOptions: { color: 'rgb(0,0,0,0)', }, cornersSquareOptions: { color: '#ffffff', type: 'extra-rounded', }, cornersDotOptions: { color: '#ffffff', type: 'dot', } }; const qrCode = new styled_qr_code_node_1.QRCodeCanvas(options); const svg = await qrCode.toDataUrl('svg'); return svg; } exports.default = createQrcode;