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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

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);
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 232 KiB

View file

@ -5,7 +5,7 @@ const client = require("../utils/client.js");
// run when the bot is added to a guild
module.exports = async (guild) => {
logger.log("info", `[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${client.users.get(guild.ownerID).username + client.users.get(guild.ownerID).discriminator} (${guild.ownerID})`);
logger.log("info", `[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${client.users.get(guild.ownerID).username}#${client.users.get(guild.ownerID).discriminator} (${guild.ownerID})`);
database.settings.set(guild.id, misc.defaults);
database.tags.set(guild.id, misc.tagDefaults);
};

View file

@ -20,7 +20,6 @@
"bufferutil": "^4.0.1",
"cowsay": "^1.4.0",
"dblapi.js": "^2.3.0",
"dotbeat": "^1.0.2",
"enmap": "^4.8.5",
"eris": "github:abalabahaha/eris#dev",
"erlpack": "github:discordapp/erlpack",