1
0
Fork 0
mirror of https://github.com/1disk/edp445.git synced 2024-08-14 22:47:02 +00:00
edp445/functions/convert-toimage.js
2022-11-26 15:27:07 +01:00

24 lines
No EOL
1,005 B
JavaScript

const Discord = require('discord.js') //Import Discord API
require('discord-inline-reply'); //Import inline replies for Discord API
const fetch = require('node-fetch'); //Import the FETCH API
module.exports = async (message, author, guild, client) => {
try {
message.react("1046014857939537950")
} catch (err) {
message.lineReply("<a:loading:1046014857939537950> Generating the image... It will take a while.")
}
const request = require('request');
let url = message.content.replace(`<@${client.user.id}> `,'')
url = url.replace('convert gif to image ', '')
request({ url, encoding: null }, (err, resp, buffer) => {
var attachment = new Discord.MessageAttachment(buffer, "sexbot-converter.png");
return message.lineReply(attachment);
});
setTimeout(function(){
message.lineReplyNoMention("Got no response? It means that you haven't provided a valid media url or you posted an attachment instead of a link.")
}, 5000);
}