mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
Added pat command
This commit is contained in:
parent
f643f61f29
commit
58858c5d09
4 changed files with 70 additions and 0 deletions
35
package-lock.json
generated
35
package-lock.json
generated
|
@ -21,6 +21,7 @@
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"onion-lasers": "^1.1.2",
|
"onion-lasers": "^1.1.2",
|
||||||
|
"pet-pet-gif": "^1.0.8",
|
||||||
"relevant-urban": "^2.0.0",
|
"relevant-urban": "^2.0.0",
|
||||||
"translate-google": "^1.4.3",
|
"translate-google": "^1.4.3",
|
||||||
"weather-js": "^2.0.0"
|
"weather-js": "^2.0.0"
|
||||||
|
@ -3015,6 +3016,14 @@
|
||||||
"assert-plus": "^1.0.0"
|
"assert-plus": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/gifencoder": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gifencoder/-/gifencoder-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-x19DcyWY10SkshBpokqFOo/HBht9GB75evRYvaLMbez9p+yB/o+kt0fK9AwW59nFiAMs2UUQsjv1lX/hvu9Ong==",
|
||||||
|
"dependencies": {
|
||||||
|
"canvas": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.1.6",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
|
@ -5334,6 +5343,15 @@
|
||||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
},
|
},
|
||||||
|
"node_modules/pet-pet-gif": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/pet-pet-gif/-/pet-pet-gif-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-xmQM2DhlSPb1Wo4L5Z6Er4QdzVUjblyUg6LgtvGGtXnwnuhOZBQ0JhNyM+1CL6zxJAG5CQFLhIXxxQa28YpBdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"gifencoder": "^2.0.1",
|
||||||
|
"lodash": "^4.17.21"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
"version": "2.2.3",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz",
|
||||||
|
@ -10179,6 +10197,14 @@
|
||||||
"assert-plus": "^1.0.0"
|
"assert-plus": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gifencoder": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gifencoder/-/gifencoder-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-x19DcyWY10SkshBpokqFOo/HBht9GB75evRYvaLMbez9p+yB/o+kt0fK9AwW59nFiAMs2UUQsjv1lX/hvu9Ong==",
|
||||||
|
"requires": {
|
||||||
|
"canvas": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.6",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
|
@ -11988,6 +12014,15 @@
|
||||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
},
|
},
|
||||||
|
"pet-pet-gif": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/pet-pet-gif/-/pet-pet-gif-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-xmQM2DhlSPb1Wo4L5Z6Er4QdzVUjblyUg6LgtvGGtXnwnuhOZBQ0JhNyM+1CL6zxJAG5CQFLhIXxxQa28YpBdg==",
|
||||||
|
"requires": {
|
||||||
|
"gifencoder": "^2.0.1",
|
||||||
|
"lodash": "^4.17.21"
|
||||||
|
}
|
||||||
|
},
|
||||||
"picomatch": {
|
"picomatch": {
|
||||||
"version": "2.2.3",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz",
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"onion-lasers": "^1.1.2",
|
"onion-lasers": "^1.1.2",
|
||||||
|
"pet-pet-gif": "^1.0.8",
|
||||||
"relevant-urban": "^2.0.0",
|
"relevant-urban": "^2.0.0",
|
||||||
"translate-google": "^1.4.3",
|
"translate-google": "^1.4.3",
|
||||||
"weather-js": "^2.0.0"
|
"weather-js": "^2.0.0"
|
||||||
|
|
30
src/commands/fun/pat.ts
Normal file
30
src/commands/fun/pat.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import {MessageAttachment, User} from "discord.js";
|
||||||
|
import {NamedCommand, Command} from "onion-lasers";
|
||||||
|
import petPetGif from "pet-pet-gif";
|
||||||
|
|
||||||
|
export default new NamedCommand({
|
||||||
|
description: "Generates a pat GIF of the provided attachment image OR the avatar of the mentioned user.",
|
||||||
|
usage: "(@user)",
|
||||||
|
async run({message, send, author}) {
|
||||||
|
if (message.attachments.size !== 0) {
|
||||||
|
const attachment = message.attachments.first()!;
|
||||||
|
const gif = await petPetGif(attachment.url);
|
||||||
|
const file = new MessageAttachment(gif, "pat.gif");
|
||||||
|
send(file);
|
||||||
|
} else {
|
||||||
|
const gif = await petPetGif(author.displayAvatarURL({format: "png"}));
|
||||||
|
const file = new MessageAttachment(gif, "pat.gif");
|
||||||
|
send(file);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
id: "user",
|
||||||
|
user: new Command({
|
||||||
|
description: "User to generate a GIF of.",
|
||||||
|
async run({send, args}) {
|
||||||
|
const user: User = args[0];
|
||||||
|
const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
|
||||||
|
const file = new MessageAttachment(gif, "pat.gif");
|
||||||
|
send(file);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
4
src/defs/petpet.d.ts
vendored
Normal file
4
src/defs/petpet.d.ts
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
declare module "pet-pet-gif" {
|
||||||
|
function petPetGif(image: string): Promise<Buffer>;
|
||||||
|
export = petPetGif;
|
||||||
|
}
|
Loading…
Reference in a new issue