Apply suggestions from code review
Co-authored-by: WatDuhHekBro <watduhhekbro@protonmail.com>
This commit is contained in:
parent
58858c5d09
commit
6003367a6b
|
@ -1,5 +1,5 @@
|
||||||
import {MessageAttachment, User} from "discord.js";
|
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";
|
import petPetGif from "pet-pet-gif";
|
||||||
|
|
||||||
export default new NamedCommand({
|
export default new NamedCommand({
|
||||||
|
@ -26,5 +26,18 @@ export default new NamedCommand({
|
||||||
const file = new MessageAttachment(gif, "pat.gif");
|
const file = new MessageAttachment(gif, "pat.gif");
|
||||||
send(file);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue