Package Exports
- spcanvas
- spcanvas/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spcanvas) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
spcanvas
Make configurable canvas easily with spcanvas
Installation
npm i spcanvas
Documentation
Example of code (Discord.js v14)
const spcanvas = require("spcanvas");
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.Presences, GatewayIntentBits.Messages] });
client.on("ready", () => {
console.log(`I connect to ${client.user.tag}`)
});
Spotify card
client.on("messageCreate", async message => {
if (message.content === "!spotify") {
const spotify = await new spcanvas.Spotify()
.setAuthor("Alan Walker, Ava Max")
.setAlbum("Alan Walker Album")
.setBackground("image", "https://th.bing.com/th/id/R.0bbabe949adc2ea6c853eddad2f38519?rik=jshX8YIYBDnF4w&pid=ImgRaw&r=0")
.setImage("https://i.scdn.co/image/ab67616d00001e02df9a35baaa98675256b35177")
.setTimestamp(40000, 179000)
.setTitle("Alone, Pt II")
.build();
message.reply({
files: [{
attachment: spotify.toBuffer(),
name: `spotify-${message.member.id}.png`
}]
});
}
});
Note
This package is the continuation of discanvas package