Upgraded retrotext and DBL posting packages, fixed mention prefixes and DM commands

This commit is contained in:
TheEssem 2021-03-18 09:29:03 -05:00
parent c0332673bf
commit 5d2e2b5274
8 changed files with 278 additions and 46 deletions

View File

@ -156,6 +156,7 @@ const runJob = (job, sock) => {
if (e) return reject(e);
return resolve();
});
return;
}).catch(e => {
reject(e);
});

2
app.js
View File

@ -57,7 +57,7 @@ async function init() {
client.connect();
// post to DBL
if (process.env.NODE_ENV === "production") {
if (process.env.NODE_ENV === "production" && process.env.DBL !== "") {
require("./utils/dbl.js");
}

View File

@ -1,4 +1,5 @@
const RetroText = require("retrotext");
const { TextStyle, BackgroundStyle } = RetroText;
exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate some retro text!`;
@ -7,14 +8,15 @@ exports.run = async (message, args) => {
if (/^[\w ]+$/i.test(line1) === false || /^[\w ]+$/i.test(line2) === false || /^[\w ]+$/i.test(line3) === false) return `${message.author.mention}, only alphanumeric characters, spaces, and underscores are allowed!`;
let text;
if (line3) {
text = new RetroText().setLine(1, line1).setLine(2, line2).setLine(3, line3).setBackgroundStyle("outlineTri").setTextStyle("chrome");
text = new RetroText.default().setLine1(line1).setLine2(line2).setLine3(line3).setBackgroundStyle(BackgroundStyle.OUTLINE_TRIANGLE).setTextStyle(TextStyle.CHROME);
} else if (line2) {
text = new RetroText().setLine(1, line1).setLine(2, line2).setBackgroundStyle("outlineTri").setTextStyle("chrome");
text = new RetroText.default().setLine1(line1).setLine2(line2).setBackgroundStyle(BackgroundStyle.OUTLINE_TRIANGLE).setTextStyle(TextStyle.CHROME);
} else {
text = new RetroText().setLine(2, line1).setBackgroundStyle("outlineTri").setTextStyle("chrome");
text = new RetroText.default().setLine2(line1).setBackgroundStyle(BackgroundStyle.OUTLINE_TRIANGLE).setTextStyle(TextStyle.CHROME);
}
const buffer = await text.fetchBuffer();
return {
file: await text.fetchBuffer(),
file: Buffer.from(buffer),
name: "retro.png"
};
};

View File

@ -37,15 +37,29 @@ module.exports = async (message) => {
}
}
// this line be like Pain. Pain. Pain. Pain. Pain. Pain. Pain. Pain. Pain. Pain. Pain. Pain.
// there's also bit of a workaround here due to member.mention not accounting for both mention types
const prefix = message.channel.guild ? (message.content.startsWith(message.channel.guild.members.get(client.user.id).mention) ? `${message.channel.guild.members.get(client.user.id).mention} ` : (message.content.startsWith(`<@${client.user.id}>`) ? `<@${client.user.id}> ` : prefixCandidate)) : "";
let prefix;
let isMention = false;
if (message.channel.guild) {
const user = message.channel.guild.members.get(client.user.id);
if (message.content.startsWith(user.mention)) {
prefix = `${user.mention} `;
isMention = true;
} else if (message.content.startsWith(`<@${client.user.id}>`)) { // workaround for member.mention not accounting for both mention types
prefix = `<@${client.user.id}> `;
isMention = true;
} else {
prefix = prefixCandidate;
}
} else {
prefix = "";
}
// ignore other stuff
if (message.content.startsWith(prefix) === false) return;
// separate commands and args
const content = message.cleanContent.substring(prefix.length).trim();
const replace = isMention ? `@${client.user.username} ` : prefix;
const content = message.cleanContent.substring(replace.length).trim();
const rawContent = message.content.substring(prefix.length).trim();
const args = content.split(/ +/g);
args.shift();

274
package-lock.json generated
View File

@ -1,17 +1,16 @@
{
"name": "esmbot",
"version": "1.4.4",
"version": "1.4.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "esmbot",
"version": "1.4.4",
"version": "1.4.5",
"license": "MIT",
"dependencies": {
"abort-controller": "^3.0.0",
"cowsay2": "^2.0.4",
"dblapi.js": "^2.4.1",
"dotenv": "^8.2.0",
"duckduckgo-images-api": "^1.0.5",
"emoji-regex": "^9.2.2",
@ -28,8 +27,9 @@
"puppeteer-extra": "^3.1.15",
"puppeteer-extra-plugin-stealth": "^2.6.5",
"qrcode": "^1.4.4",
"retrotext": "github:TheEssem/retrotext",
"retrotext": "^4.0.1",
"sharp": "^0.26.3",
"topgg-autoposter": "^1.1.9",
"winston": "^3.3.3"
},
"devDependencies": {
@ -89,6 +89,15 @@
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
"integrity": "sha512-XO6INPbZCxdprl+9qa/AAbFFOMzzwqYxpjPgLICrMD6C2FCw6qfJOPcBk6JqqPLSaZ/Qx87qn4rpPmPMwaAK6w=="
},
"node_modules/@top-gg/sdk": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/@top-gg/sdk/-/sdk-3.0.9.tgz",
"integrity": "sha512-AskJQk6+89lIGu6UzjsDxXe4wRuc9lbpXwftIzzng2+kB8R3ZzN7hwa1nC/AacLG07m0gbBwQBWlE5IgexA/kg==",
"dependencies": {
"node-fetch": "^2.6.1",
"raw-body": "^2.4.1"
}
},
"node_modules/@types/bson": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz",
@ -439,6 +448,14 @@
"node-gyp-build": "^4.2.0"
}
},
"node_modules/bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -749,12 +766,6 @@
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/dblapi.js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.4.1.tgz",
"integrity": "sha512-g+u1inF/qOLit5qPK4hBGk5pKL1vy09uBLV+nukkRMvw2S9D1PyiyO70n4fboUXOgbExPp6Sho/Y782OqQOUiQ==",
"deprecated": "Module is no longer maintained"
},
"node_modules/debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
@ -837,6 +848,14 @@
"node": ">=0.10"
}
},
"node_modules/depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/detect-libc": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
@ -1581,6 +1600,21 @@
"entities": "^2.0.0"
}
},
"node_modules/http-errors": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
"integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
"dependencies": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
@ -1597,7 +1631,6 @@
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
@ -1842,6 +1875,23 @@
"node": ">=0.10.0"
}
},
"node_modules/isomorphic-form-data": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-2.0.0.tgz",
"integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==",
"dependencies": {
"form-data": "^2.3.2"
}
},
"node_modules/isomorphic-unfetch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz",
"integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==",
"dependencies": {
"node-fetch": "^2.6.1",
"unfetch": "^4.2.0"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -2900,6 +2950,20 @@
"node": ">=4"
}
},
"node_modules/raw-body": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz",
"integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==",
"dependencies": {
"bytes": "3.1.0",
"http-errors": "1.7.3",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/rc": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
@ -3037,13 +3101,13 @@
}
},
"node_modules/retrotext": {
"version": "3.1.1",
"resolved": "git+ssh://git@github.com/TheEssem/retrotext.git#1be485d2b7b297138459191bbb9d4f8336cc3477",
"license": "ISC",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/retrotext/-/retrotext-4.0.1.tgz",
"integrity": "sha512-Xrw03SCI5lC03tchbS1dGntqJrXs2N/H92yTI14EwMwL5pZHlR45z86DFUECMxzsF3xtTCiXM1+VpThIoGDgZw==",
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"form-data": "^2.3.3",
"node-fetch": "^2.3.0"
"cheerio": "^1.0.0-rc.3",
"isomorphic-form-data": "^2.0.0",
"isomorphic-unfetch": "^3.0.0"
}
},
"node_modules/rimraf": {
@ -3101,8 +3165,7 @@
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/saslprep": {
"version": "1.0.3",
@ -3129,6 +3192,11 @@
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"node_modules/setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"node_modules/shallow-clone": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz",
@ -3363,6 +3431,14 @@
"node": "*"
}
},
"node_modules/statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@ -3603,6 +3679,14 @@
"node": ">=0.6.0"
}
},
"node_modules/toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/token-types": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-2.1.1.tgz",
@ -3619,6 +3703,15 @@
"url": "https://github.com/sponsors/Borewit"
}
},
"node_modules/topgg-autoposter": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/topgg-autoposter/-/topgg-autoposter-1.1.9.tgz",
"integrity": "sha512-NHyBvak1yz5fazlVNYFvvC6JLDlJCbOF9VcVtCuLMlnlCIT/HKElacmj3Rr8TaUqc7aYpWG2zBpcki2uBjyK6Q==",
"dependencies": {
"@top-gg/sdk": "^3.0.9",
"typescript": "^4.2.3"
}
},
"node_modules/triple-beam": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
@ -3667,6 +3760,18 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/typescript": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/unbzip2-stream": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
@ -3676,6 +3781,11 @@
"through": "^2.3.8"
}
},
"node_modules/unfetch": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
},
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@ -3684,6 +3794,14 @@
"node": ">= 4.0.0"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -4099,6 +4217,15 @@
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
"integrity": "sha512-XO6INPbZCxdprl+9qa/AAbFFOMzzwqYxpjPgLICrMD6C2FCw6qfJOPcBk6JqqPLSaZ/Qx87qn4rpPmPMwaAK6w=="
},
"@top-gg/sdk": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/@top-gg/sdk/-/sdk-3.0.9.tgz",
"integrity": "sha512-AskJQk6+89lIGu6UzjsDxXe4wRuc9lbpXwftIzzng2+kB8R3ZzN7hwa1nC/AacLG07m0gbBwQBWlE5IgexA/kg==",
"requires": {
"node-fetch": "^2.6.1",
"raw-body": "^2.4.1"
}
},
"@types/bson": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz",
@ -4377,6 +4504,11 @@
"node-gyp-build": "^4.2.0"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -4630,11 +4762,6 @@
"resolved": "https://registry.npmjs.org/css-what/-/css-what-4.0.0.tgz",
"integrity": "sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A=="
},
"dblapi.js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.4.1.tgz",
"integrity": "sha512-g+u1inF/qOLit5qPK4hBGk5pKL1vy09uBLV+nukkRMvw2S9D1PyiyO70n4fboUXOgbExPp6Sho/Y782OqQOUiQ=="
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
@ -4688,6 +4815,11 @@
"integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==",
"optional": true
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"detect-libc": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
@ -5262,6 +5394,18 @@
"entities": "^2.0.0"
}
},
"http-errors": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
"integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
@ -5275,7 +5419,6 @@
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
@ -5447,6 +5590,23 @@
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
},
"isomorphic-form-data": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-2.0.0.tgz",
"integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==",
"requires": {
"form-data": "^2.3.2"
}
},
"isomorphic-unfetch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz",
"integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==",
"requires": {
"node-fetch": "^2.6.1",
"unfetch": "^4.2.0"
}
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -6265,6 +6425,17 @@
"yargs": "^13.2.4"
}
},
"raw-body": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz",
"integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==",
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.3",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"rc": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
@ -6380,12 +6551,13 @@
}
},
"retrotext": {
"version": "git+ssh://git@github.com/TheEssem/retrotext.git#1be485d2b7b297138459191bbb9d4f8336cc3477",
"from": "retrotext@github:TheEssem/retrotext",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/retrotext/-/retrotext-4.0.1.tgz",
"integrity": "sha512-Xrw03SCI5lC03tchbS1dGntqJrXs2N/H92yTI14EwMwL5pZHlR45z86DFUECMxzsF3xtTCiXM1+VpThIoGDgZw==",
"requires": {
"cheerio": "^1.0.0-rc.2",
"form-data": "^2.3.3",
"node-fetch": "^2.3.0"
"cheerio": "^1.0.0-rc.3",
"isomorphic-form-data": "^2.0.0",
"isomorphic-unfetch": "^3.0.0"
}
},
"rimraf": {
@ -6420,8 +6592,7 @@
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"saslprep": {
"version": "1.0.3",
@ -6442,6 +6613,11 @@
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"shallow-clone": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz",
@ -6616,6 +6792,11 @@
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@ -6815,6 +6996,11 @@
"os-tmpdir": "~1.0.2"
}
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"token-types": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-2.1.1.tgz",
@ -6824,6 +7010,15 @@
"ieee754": "^1.2.1"
}
},
"topgg-autoposter": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/topgg-autoposter/-/topgg-autoposter-1.1.9.tgz",
"integrity": "sha512-NHyBvak1yz5fazlVNYFvvC6JLDlJCbOF9VcVtCuLMlnlCIT/HKElacmj3Rr8TaUqc7aYpWG2zBpcki2uBjyK6Q==",
"requires": {
"@top-gg/sdk": "^3.0.9",
"typescript": "^4.2.3"
}
},
"triple-beam": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
@ -6866,6 +7061,11 @@
"is-typedarray": "^1.0.0"
}
},
"typescript": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw=="
},
"unbzip2-stream": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
@ -6875,11 +7075,21 @@
"through": "^2.3.8"
}
},
"unfetch": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",

View File

@ -24,7 +24,6 @@
"dependencies": {
"abort-controller": "^3.0.0",
"cowsay2": "^2.0.4",
"dblapi.js": "^2.4.1",
"dotenv": "^8.2.0",
"duckduckgo-images-api": "^1.0.5",
"emoji-regex": "^9.2.2",
@ -41,8 +40,9 @@
"puppeteer-extra": "^3.1.15",
"puppeteer-extra-plugin-stealth": "^2.6.5",
"qrcode": "^1.4.4",
"retrotext": "github:TheEssem/retrotext",
"retrotext": "^4.0.1",
"sharp": "^0.26.3",
"topgg-autoposter": "^1.1.9",
"winston": "^3.3.3"
},
"devDependencies": {

View File

@ -1,8 +1,11 @@
// dbl api client
const DBL = require("dblapi.js");
const poster = require("topgg-autoposter");
const logger = require("./logger.js");
const client = require("./client.js");
const dbl = new DBL(process.env.DBL, client);
const dbl = poster(process.env.DBL, client);
dbl.on("posted", () => {
logger.log("Posted stats to top.gg");
});
dbl.on("error", e => {
logger.error(e);
});

View File

@ -96,6 +96,7 @@ const getIdeal = () => {
const server = await chooseServer(idealServers);
resolve(connections.find(val => val.remoteAddress === server.addr));
}
return;
}).catch(e => reject(e));
}
});
@ -128,7 +129,7 @@ const start = (object, num) => {
jobs[num] = event;
});
}, (result) => {
return Promise.reject(result);
throw result;
}).then(data => {
delete jobs[num];
jobs[data.uuid] = data.event;
@ -201,6 +202,7 @@ exports.run = object => {
data.event.once("error", (err) => {
reject(err);
});
return;
}).catch(err => reject(err));
} else {
// Called from command (not using image API)