-
Notifications
You must be signed in to change notification settings - Fork 0
/
drip.js
53 lines (46 loc) · 1.63 KB
/
drip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const { loadImage, createCanvas } = require("canvas")
const { AttachmentBuilder } = require("discord.js")
const Interaction = require("../../Structures/Interaction")
const Util = require("../../Utils/util.js")
module.exports = class DripInteraction extends Interaction {
constructor() {
super("drip", {
type: 1,
description: 'Drip uma imagem',
defaultPermission: true,
options: [
{
name: 'imagem',
description: 'Menção de um usuário, link de uma imagem e caso não tenha nada vai buscar a última imagem do chat',
type: 3,
required: false
},
{
name: 'imagem_anexo',
description: 'Imagem drip',
type: 11, // Attachment
required: false
},
],
channelTypes: ["GUILD_TEXT", "DM"]
})
}
async execute({ interaction, args, client }) {
await interaction.deferReply()
const img = await loadImage(await Util.getImage(interaction, args, client))
const canvas = createCanvas(867, 892)
const ctx = canvas.getContext('2d')
const background = await loadImage('https://media.discordapp.net/attachments/776941533987209227/829874637114310677/image-removebg-preview.png?width=415&height=428');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
//ctx.beginPath()
//ctx.arc(350, 150, 100, 0, Math.PI * 2, true);
//ctx.clip()
//ctx.closePath()
ctx.drawImage(img, 350, 150, 205, 205)
return await interaction.followUp({
files: [
new AttachmentBuilder(canvas.toBuffer(), { name: `Drip${interaction.user.username}.jpg` })
]
})
}
}