Fixed wikihow request URL and headers, removed unnecessary optimization from motivate
This commit is contained in:
parent
f3dd98c293
commit
addb16fcd0
4 changed files with 8 additions and 115 deletions
|
@ -17,12 +17,12 @@ exports.run = async (message, args) => {
|
||||||
const size2 = await gm(file).sizePromise();
|
const size2 = await gm(file).sizePromise();
|
||||||
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
|
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
|
||||||
const size3 = await gm(text).sizePromise();
|
const size3 = await gm(text).sizePromise();
|
||||||
const command2 = gm(file).gravity("North").coalesce().extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite", "-layers", "optimize");
|
const command2 = gm(file).gravity("North").coalesce().extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite");
|
||||||
let resultBuffer;
|
let resultBuffer;
|
||||||
if (bottomText) {
|
if (bottomText) {
|
||||||
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
||||||
const size4 = await gm(text2).sizePromise();
|
const size4 = await gm(text2).sizePromise();
|
||||||
resultBuffer = await gm(await command2.bufferPromise(image.type, image.delay)).gravity("North").coalesce().extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type, image.delay);
|
resultBuffer = await gm(await command2.bufferPromise(image.type, image.delay)).gravity("North").coalesce().extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite").bufferPromise(image.type, image.delay);
|
||||||
} else {
|
} else {
|
||||||
resultBuffer = await command2.bufferPromise(image.type, image.delay);
|
resultBuffer = await command2.bufferPromise(image.type, image.delay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@ const fetch = require("node-fetch");
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const request = await fetch("https://hargrimm-wikihow-v1.p.mashape.com/images?count=1", {
|
const request = await fetch("https://hargrimm-wikihow-v1.p.rapidapi.com/images?count=1", {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Mashape-Key": process.env.MASHAPE,
|
"X-RapidAPI-Key": process.env.MASHAPE,
|
||||||
|
"X-RapidAPI-Host": "hargrimm-wikihow-v1.p.rapidapi.com",
|
||||||
"Accept": "application/json"
|
"Accept": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
113
package-lock.json
generated
113
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "esmbot",
|
"name": "esmbot",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -741,8 +741,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"erlpack": {
|
"erlpack": {
|
||||||
"version": "0.1.3",
|
"version": "github:abalabahaha/erlpack#5d0064f9e106841e1eead711a6451f99b0d289fd",
|
||||||
"resolved": "github:abalabahaha/erlpack#5d0064f9e106841e1eead711a6451f99b0d289fd",
|
"from": "github:abalabahaha/erlpack",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bindings": "^1.5.0",
|
"bindings": "^1.5.0",
|
||||||
|
@ -996,56 +996,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
|
||||||
"integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg=="
|
"integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg=="
|
||||||
},
|
},
|
||||||
"ffi-napi": {
|
|
||||||
"version": "2.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ffi-napi/-/ffi-napi-2.5.0.tgz",
|
|
||||||
"integrity": "sha512-ninYS+GI4BDFOg29dEJ68uZOcWgCp05teU4Lm40vrnyh+E1fYjKYvTDMYAG+WUD75NNHPTJhNjgVqv5whSgU3w==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^3.1.0",
|
|
||||||
"get-uv-event-loop-napi-h": "^1.0.5",
|
|
||||||
"node-addon-api": "1.6.1",
|
|
||||||
"node-gyp-build": "^4.2.1",
|
|
||||||
"ref-napi": "^1.5.2",
|
|
||||||
"ref-struct-di": "^1.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": {
|
|
||||||
"version": "3.2.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
|
||||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "^2.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node-addon-api": {
|
|
||||||
"version": "1.6.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.6.1.tgz",
|
|
||||||
"integrity": "sha512-GcLOYrG5/enbqH4SMsqXt6GQUQGGnDnE3FLDZzXYkCgQHuZV5UDFR+EboeY8kpG0avroyOjpFQ2qLEBosFcRIA=="
|
|
||||||
},
|
|
||||||
"node-gyp-build": {
|
|
||||||
"version": "4.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.2.tgz",
|
|
||||||
"integrity": "sha512-Lqh7mrByWCM8Cf9UPqpeoVBBo5Ugx+RKu885GAzmLBVYjeywScxHXPGLa4JfYNZmcNGwzR0Glu5/9GaQZMFqyA=="
|
|
||||||
},
|
|
||||||
"ref-napi": {
|
|
||||||
"version": "1.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-1.5.2.tgz",
|
|
||||||
"integrity": "sha512-hwyNmWpUkt1bDWDW4aiwCoC+SJfJO69UIdjqssNqdaS0sYJpgqzosGg/rLtk69UoQ8drZdI9yyQefM7eEMM3Gw==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^3.1.0",
|
|
||||||
"node-addon-api": "^2.0.0",
|
|
||||||
"node-gyp-build": "^4.2.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"node-addon-api": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"figures": {
|
"figures": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
||||||
|
@ -1221,19 +1171,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz",
|
||||||
"integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g="
|
"integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g="
|
||||||
},
|
},
|
||||||
"get-symbol-from-current-process-h": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw=="
|
|
||||||
},
|
|
||||||
"get-uv-event-loop-napi-h": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz",
|
|
||||||
"integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==",
|
|
||||||
"requires": {
|
|
||||||
"get-symbol-from-current-process-h": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"github-from-package": {
|
"github-from-package": {
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||||
|
@ -1546,14 +1483,6 @@
|
||||||
"yallist": "^2.1.2"
|
"yallist": "^2.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"magick-ffi": {
|
|
||||||
"version": "github:Terradice/magick-ffi#8911ffad4cdad8e67991ac0f214eff5ed42215a8",
|
|
||||||
"from": "github:Terradice/magick-ffi",
|
|
||||||
"requires": {
|
|
||||||
"ffi-napi": "^2.5.0",
|
|
||||||
"ref-napi": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"memory-pager": {
|
"memory-pager": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||||
|
@ -2137,42 +2066,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-2.0.0.tgz",
|
||||||
"integrity": "sha512-+oZJurc4hXpaaqsN68GoZGQAQIA3qr09Or4fqEsargABnbe5Aau8hFn6ISVleT3cpY/0n/8drn7huyyEvTbghA=="
|
"integrity": "sha512-+oZJurc4hXpaaqsN68GoZGQAQIA3qr09Or4fqEsargABnbe5Aau8hFn6ISVleT3cpY/0n/8drn7huyyEvTbghA=="
|
||||||
},
|
},
|
||||||
"ref-napi": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-Uh/vcTemN/yhyW/JtuySkDb5TLxEuaZITVFJup/UeNZytNaAVV6TGU7cYMCSUR0t9MrS4TBE+olDuP6vtl0qhw==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^4.1.1",
|
|
||||||
"get-symbol-from-current-process-h": "^1.0.2",
|
|
||||||
"node-addon-api": "^2.0.0",
|
|
||||||
"node-gyp-build": "^4.2.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"node-gyp-build": {
|
|
||||||
"version": "4.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.2.tgz",
|
|
||||||
"integrity": "sha512-Lqh7mrByWCM8Cf9UPqpeoVBBo5Ugx+RKu885GAzmLBVYjeywScxHXPGLa4JfYNZmcNGwzR0Glu5/9GaQZMFqyA=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ref-struct-di": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ref-struct-di/-/ref-struct-di-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-gghZITj/iQwdwFDduZ6T8kL2B2ogInlOz7AOB0ggFoEc7akAKMcDrbzh3OIPk13Kxy8U2bHPvN6nejcBh4jN7A==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": {
|
|
||||||
"version": "3.2.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
|
||||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "^2.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"regexp-clone": {
|
"regexp-clone": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
"file-type": "^13.1.2",
|
"file-type": "^13.1.2",
|
||||||
"gm": "github:TheEssem/gm",
|
"gm": "github:TheEssem/gm",
|
||||||
"jsqr": "^1.2.0",
|
"jsqr": "^1.2.0",
|
||||||
"magick-ffi": "github:Terradice/magick-ffi",
|
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"moment-duration-format": "^2.3.2",
|
"moment-duration-format": "^2.3.2",
|
||||||
"mongoose": "^5.9.9",
|
"mongoose": "^5.9.9",
|
||||||
|
|
Loading…
Reference in a new issue