mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 00:12:32 +02:00
Make size smaller
This commit is contained in:
@@ -40,7 +40,7 @@ module.exports = class FireCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { user }) {
|
async run(msg, { user }) {
|
||||||
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 });
|
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 256 });
|
||||||
const { body } = await request.get(avatarURL);
|
const { body } = await request.get(avatarURL);
|
||||||
const avatar = await loadImage(body);
|
const avatar = await loadImage(body);
|
||||||
const encoder = new GIFEncoder(avatar.width, avatar.height);
|
const encoder = new GIFEncoder(avatar.width, avatar.height);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = class MatrixCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { user }) {
|
async run(msg, { user }) {
|
||||||
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 });
|
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 256 });
|
||||||
await reactIfAble(msg, msg.author, LOADING_EMOJI_ID, '💬');
|
await reactIfAble(msg, msg.author, LOADING_EMOJI_ID, '💬');
|
||||||
const { body } = await request.get(avatarURL);
|
const { body } = await request.get(avatarURL);
|
||||||
const avatar = await loadImage(body);
|
const avatar = await loadImage(body);
|
||||||
@@ -63,7 +63,7 @@ module.exports = class MatrixCommand extends Command {
|
|||||||
const distortedCtx = distortedCanvas.getContext('2d');
|
const distortedCtx = distortedCanvas.getContext('2d');
|
||||||
distortedCtx.drawImage(avatar, 0, 0);
|
distortedCtx.drawImage(avatar, 0, 0);
|
||||||
distort(distortedCtx, 20, 0, 0, avatar.width, avatar.height, 5);
|
distort(distortedCtx, 20, 0, 0, avatar.width, avatar.height, 5);
|
||||||
for (let i = 0; i < frameCount; i += 2) {
|
for (let i = 0; i < frameCount; i++) {
|
||||||
const frame = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'matrix', `frame-${i}.gif`));
|
const frame = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'matrix', `frame-${i}.gif`));
|
||||||
const ratio = frame.width / frame.height;
|
const ratio = frame.width / frame.height;
|
||||||
const width = Math.round(avatar.height / ratio);
|
const width = Math.round(avatar.height / ratio);
|
||||||
|
|||||||
Reference in New Issue
Block a user