mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Beep
This commit is contained in:
@@ -2,7 +2,7 @@ const { Command } = require('discord.js-commando');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const snekfetch = require('snekfetch');
|
||||
const path = require('path');
|
||||
const { distort, drawImageWithTint } = require('../../util/Canvas');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class HeLivesInYouCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -38,15 +38,11 @@ module.exports = class HeLivesInYouCommand extends Command {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const avatarCanvas = createCanvas(avatar.width, avatar.height);
|
||||
const avatarCtx = avatarCanvas.getContext('2d');
|
||||
avatarCtx.drawImage(avatar, 0, 0);
|
||||
distort(avatarCtx, 5, 0, 0, avatar.width, avatar.height);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(-24 * (Math.PI / 180));
|
||||
drawImageWithTint(ctx, avatarCanvas, '#00115d', 75, 160, 130, 150);
|
||||
drawImageWithTint(ctx, avatar, '#00115d', 75, 160, 130, 150);
|
||||
ctx.rotate(24 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user