import { utilityCmd } from "../types"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { downloadFile, messageLink, SECONDS } from "../../../utils"; import { sendErrorMessage } from "../../../pluginUtils"; import { TextChannel } from "eris"; import { activeReloads } from "../guildReloads"; import fs from "fs"; import sharp from "sharp"; import twemoji from "twemoji"; const fsp = fs.promises; async function getBufferFromUrl(url: string): Promise { const downloadedEmoji = await downloadFile(url); return fsp.readFile(downloadedEmoji.path); } async function resizeBuffer(input: Buffer, width: number, height: number): Promise { return sharp(input, { density: 800 }) .resize(width, height, { fit: "inside", }) .toBuffer(); } const CDN_URL = "https://twemoji.maxcdn.com/2/svg"; export const JumboCmd = utilityCmd({ trigger: "jumbo", description: "Makes an emoji jumbo", permission: "can_jumbo", cooldown: 5 * SECONDS, signature: { emoji: ct.string(), }, async run({ message: msg, args, pluginData }) { // Get emoji url const config = pluginData.config.get(); const size = config.jumbo_size > 2048 ? 2048 : config.jumbo_size; const emojiRegex = new RegExp(`(<.*:).*:(\\d+)`); const results = emojiRegex.exec(args.emoji); let extention = ".png"; let file; if (results) { let url = "https://cdn.discordapp.com/emojis/"; if (results[1] === "