Added command usage count to help, remove nonexistent commands from database, add build method to package.json
This commit is contained in:
parent
f9c8d6b26d
commit
70c4ff298f
6 changed files with 21 additions and 9 deletions
|
@ -10,23 +10,30 @@ exports.run = async (message, args) => {
|
|||
const commands = collections.commands;
|
||||
const aliases = collections.aliases;
|
||||
if (args.length !== 0 && (commands.has(args[0].toLowerCase()) || aliases.has(args[0].toLowerCase()))) {
|
||||
const info = aliases.has(args[0].toLowerCase()) ? collections.info.get(collections.aliases.get(args[0].toLowerCase())) : collections.info.get(args[0].toLowerCase());
|
||||
const command = aliases.has(args[0].toLowerCase()) ? collections.aliases.get(args[0].toLowerCase()) : args[0].toLowerCase();
|
||||
const info = collections.info.get(command);
|
||||
const counts = (await database.global.findOne({})).cmdCounts;
|
||||
const embed = {
|
||||
"embed": {
|
||||
"author": {
|
||||
"name": "esmBot Help",
|
||||
"icon_url": client.user.avatarURL
|
||||
},
|
||||
"title": `${guild.prefix}${aliases.has(args[0].toLowerCase()) ? collections.aliases.get(args[0].toLowerCase()) : args[0].toLowerCase()}`,
|
||||
"title": `${guild.prefix}${command}`,
|
||||
"url": "https://projectlounge.pw/esmBot/help.html",
|
||||
"description": info.description,
|
||||
"color": 16711680,
|
||||
"fields": [{
|
||||
"name": "Aliases",
|
||||
"value": info.aliases ? info.aliases.join(", ") : "None"
|
||||
}, {
|
||||
"name": "Times Used",
|
||||
"value": counts.get(command),
|
||||
"inline": true
|
||||
}, {
|
||||
"name": "Parameters",
|
||||
"value": info.params ? info.params : "None"
|
||||
"value": info.params ? info.params : "None",
|
||||
"inline": true
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -70,12 +70,19 @@ module.exports = async () => {
|
|||
});
|
||||
await newGlobal.save();
|
||||
} else {
|
||||
const exists = [];
|
||||
for (const command of collections.commands.keys()) {
|
||||
if (!global.cmdCounts.has(command)) {
|
||||
global.cmdCounts.set(command, 0);
|
||||
await global.save();
|
||||
}
|
||||
exists.push(command);
|
||||
}
|
||||
for (const command of global.cmdCounts.keys()) {
|
||||
if (!exists.includes(command)) {
|
||||
global.cmdCounts.set(command, undefined);
|
||||
}
|
||||
}
|
||||
await global.save();
|
||||
}
|
||||
|
||||
// generate docs
|
||||
|
|
|
@ -20,7 +20,6 @@ class CaptionWorker : public Napi::AsyncWorker {
|
|||
readImages(&frames, in_path);
|
||||
|
||||
size_t width = frames.front().baseColumns();
|
||||
size_t height = frames.front().baseRows();
|
||||
string query(to_string(width - ((width / 25) * 2)) + "x");
|
||||
Image caption_image(Geometry(query), Color("white"));
|
||||
caption_image.fillColor("black");
|
||||
|
|
|
@ -20,7 +20,6 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
|
|||
readImages(&frames, in_path);
|
||||
|
||||
size_t width = frames.front().baseColumns();
|
||||
size_t height = frames.front().baseRows();
|
||||
string query(to_string(width - ((width / 25) * 2)) + "x");
|
||||
Image caption_image(Geometry(query), Color("white"));
|
||||
caption_image.fillColor("black");
|
||||
|
@ -31,7 +30,6 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
|
|||
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
int iterator = 0;
|
||||
for (Image &image : coalesced) {
|
||||
Image appended;
|
||||
list<Image> images;
|
||||
|
|
|
@ -52,7 +52,7 @@ class SpinWorker : public Napi::AsyncWorker {
|
|||
|
||||
private:
|
||||
string in_path, type;
|
||||
int delay, wordlength, n;
|
||||
int delay;
|
||||
Blob blob;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
"description": "A Discord bot with miscellaneous features",
|
||||
"main": "app.js",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node-gyp configure build",
|
||||
"docker:build": "docker build -t headless-chrome-alpine --no-cache ./utils/screenshot",
|
||||
"docker:run-ss": "docker run --rm --shm-size=128m headless-chrome-alpine",
|
||||
"docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml -v \"$(pwd)\"/assets:/opt/Lavalink/assets fredboat/lavalink:dev"
|
||||
|
|
Loading…
Reference in a new issue