Skip to content

Instantly share code, notes, and snippets.

View BlueSkunka's full-sized avatar
🐼
Panda

BlueSkunka

🐼
Panda
View GitHub Profile
@BlueSkunka
BlueSkunka / chartjs-discordjs.js
Created December 30, 2021 15:26
Generate Chart.js graph and reply with discord bot with graph as embed message
const { SlashCommandBuilder } = require("@discordjs/builders");
const rp = require("request-promise");
const { MessageEmbed, MessageAttachment } = require("discord.js");
const { ChartJSNodeCanvas } = require("chartjs-node-canvas");
let chartEmbed = {};
// This function will return MessageAttachment object from discord.js
// Pass as much parameter as you need
const generateCanva = async (labels, datas) => {
const renderer = new ChartJSNodeCanvas({ width: 800, height: 300 });