Compare commits
2 Commits
65adff92d0
...
2718e8a38c
Author | SHA1 | Date | |
---|---|---|---|
|
2718e8a38c | ||
|
99d28a3106 |
37
commands/general/recognize.js
Normal file
37
commands/general/recognize.js
Normal file
@ -0,0 +1,37 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const cmd = require('cmd-promise')
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
name: "recognize",
|
||||
description: "recognize an object within an image using TinyGrad",
|
||||
options: [{
|
||||
"name": "image",
|
||||
"description": "A 3 layer jpg",
|
||||
"required": true,
|
||||
"type": 11 // 6 is type USER
|
||||
}],
|
||||
run: async (client, interaction) => {
|
||||
let rand = Math.floor(Math.random() * 99999999999999);
|
||||
|
||||
fileURL = interaction.options._hoistedOptions[0].attachment.url
|
||||
|
||||
cmd(`wget -O images/${rand}.jpg ${fileURL} && recognize images/${rand}.jpg`).then(out => {
|
||||
(async () => {
|
||||
await interaction.editReply({
|
||||
files: [`images/${rand}.jpg`],
|
||||
content: out.stdout
|
||||
});
|
||||
fs.unlinkSync(`images/${rand}.jpg`);
|
||||
})();
|
||||
}).catch(err => {
|
||||
(async () => {
|
||||
await interaction.editReply({
|
||||
content: "There was an error, try another image."
|
||||
});
|
||||
fs.unlinkSync(`images/${rand}.jpg`);
|
||||
})();
|
||||
})
|
||||
|
||||
},
|
||||
};
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"awesome-qr": "^2.1.5-rc.0",
|
||||
"cmd-promise": "^1.2.0",
|
||||
"discord.js": "^14.0.3",
|
||||
"dotenv": "^16.0.0",
|
||||
"download-file": "^0.1.5",
|
||||
@ -360,6 +361,11 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/cmd-promise": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cmd-promise/-/cmd-promise-1.2.0.tgz",
|
||||
"integrity": "sha512-6lxSMygXwx7PPoOsK4k41DFHXeF/bsu4q4MyPL9MQkRHFzxiLqkgWl0FfoJV0w3VOo8AvCDzPLnCMgp4DB0SfQ=="
|
||||
},
|
||||
"node_modules/color-support": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
|
||||
@ -1889,6 +1895,11 @@
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="
|
||||
},
|
||||
"cmd-promise": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cmd-promise/-/cmd-promise-1.2.0.tgz",
|
||||
"integrity": "sha512-6lxSMygXwx7PPoOsK4k41DFHXeF/bsu4q4MyPL9MQkRHFzxiLqkgWl0FfoJV0w3VOo8AvCDzPLnCMgp4DB0SfQ=="
|
||||
},
|
||||
"color-support": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
|
||||
|
@ -12,6 +12,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"awesome-qr": "^2.1.5-rc.0",
|
||||
"cmd-promise": "^1.2.0",
|
||||
"discord.js": "^14.0.3",
|
||||
"dotenv": "^16.0.0",
|
||||
"download-file": "^0.1.5",
|
||||
|
Loading…
Reference in New Issue
Block a user