Apply suggestions from code review

Co-authored-by: WatDuhHekBro <watduhhekbro@protonmail.com>
This commit is contained in:
Alyxia Sother 2021-05-17 19:49:10 +02:00 committed by GitHub
parent 58858c5d09
commit 6003367a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import {MessageAttachment, User} from "discord.js";
import {NamedCommand, Command} from "onion-lasers";
import {NamedCommand, Command, RestCommand, getUserByNickname} from "onion-lasers";
import petPetGif from "pet-pet-gif";
export default new NamedCommand({
@ -26,5 +26,18 @@ export default new NamedCommand({
const file = new MessageAttachment(gif, "pat.gif");
send(file);
}
}),
any: new RestCommand({
description: "User to generate a GIF of.",
async run({send, combined, guild}) {
const user = await getUserByNickname(combined, guild);
if (typeof user === "string") send(user);
else {
const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif");
send(file);
}
}
})
});