Added stats, fixed some bugs, removed unneeded dependencies

This commit is contained in:
TheEssem 2019-09-14 23:22:29 -05:00
parent 65f4bc00de
commit 5a08ed57cc
7 changed files with 42 additions and 28 deletions

View file

@ -1,25 +0,0 @@
const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
const fetch = require("node-fetch");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Brazzers watermark!`;
message.channel.sendTyping();
const watermark = "./assets/images/brazzers.png";
const imageData = await fetch(image.url);
const imageBuffer = await imageData.buffer();
gm(imageBuffer).size(async (error, size) => {
if (error) console.error;
const data = gm(imageBuffer).composite(watermark).gravity("SouthEast").resize(size.width, null);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {
file: resultBuffer,
name: `brazzers.${image.type}`
});
});
};
exports.aliases = ["brazzer", "br"];

View file

@ -2,5 +2,5 @@ const database = require("../utils/database.js");
exports.run = async (message) => {
const guildConf = database.settings.get(message.channel.guild.id);
return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guildConf.prefix[0]}\`.`;
return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guildConf.prefix}\`.`;
};

40
commands/stats.js Normal file
View file

@ -0,0 +1,40 @@
const client = require("../utils/client.js");
const moment = require("moment");
require("moment-duration-format");
const os = require("os");
exports.run = async (message) => {
const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
const embed = {
embed: {
"author": {
"name": "esmBot Statistics",
"icon_url": client.user.avatarURL
},
"color": 16711680,
"description": "**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs.**",
"fields": [{
"name": "Memory Usage",
"value": `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`
},
{
"name": "Uptime",
"value": duration
},
{
"name": "Host",
"value": `${os.type()} ${os.release()} (${os.arch()})`
},
{
"name": "Library",
"value": `Eris ${require("eris").VERSION}`
},
{
"name": "Node.js Version",
"value": process.version
}
]
}
};
return message.channel.createMessage(embed);
};