Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { RemoveBgResult, RemoveBgError, removeBackgroundFromImageUrl } = require("remove.bg");
- client.on('message', message =>{
- if(message.author.bot) return;
- if(!message.guild) return;
- if(message.content.startsWith(prefix + 'remove')){
- const url = message.content.split(' ').slice(1).join(' ')
- if(!url) return message.channel.send(`${prefix}remove <URL>`)
- const outputFile = `${__dirname}/${message.author.id}.png`;
- try {
- removeBackgroundFromImageUrl({
- url,
- apiKey: "oEecsQFNG5NnzBVrVTUj6WxV",
- size: "regular",
- type: "auto",
- outputFile
- }).then(a=>{
- message.channel.send({files : [outputFile]})
- })
- } catch (error) {
- console.log(error)
- message.channel.send(error)
- }
- }
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment