Skip to content

Instantly share code, notes, and snippets.

@LiamTownsley
Created February 6, 2021 14:44
Show Gist options
  • Save LiamTownsley/fb20d404a3451b667fbfddd9298fafc1 to your computer and use it in GitHub Desktop.
Save LiamTownsley/fb20d404a3451b667fbfddd9298fafc1 to your computer and use it in GitHub Desktop.
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('message', async msg => {
if(msg.author.bot) return;
if(msg.content === '!test') {
const Hook = new Discord.WebhookClient("WEBHOOK_ID", "WEBHOOK_TOKEN");
const image = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/.........'
const imageStream = new Buffer.from(image.split("base64,")[1],'base64');
const attachment = new Discord.MessageAttachment(imageStream);
const embed = new Discord.MessageEmbed().attachFiles(attachment);
Hook.send(embed);
}
});
bot.login('DISCORD_TOKEN');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment