Added stretch and wide, added notice to tags list, changed ping messages

This commit is contained in:
TheEssem 2019-12-13 22:13:35 -06:00
parent 08ec2ca9ea
commit 29cd75ac3d
5 changed files with 47 additions and 2 deletions

View file

@ -2,7 +2,7 @@ const client = require("../utils/client.js");
exports.run = async (message) => {
const pingMessage = await client.createMessage(message.channel.id, "🏓 Ping?");
return pingMessage.edit(`🏓 Pong! Latency is ${pingMessage.timestamp - message.timestamp}ms. API Latency is ${Math.round(client.shards.get(client.guildShardMap[message.channel.guild.id]).latency)}ms.`);
return pingMessage.edit(`🏓 Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - message.timestamp}ms\nAPI Latency: ${Math.round(client.shards.get(client.guildShardMap[message.channel.guild.id]).latency)}ms\n\`\`\``);
};
exports.aliases = ["pong"];

20
commands/stretch.js Normal file
View file

@ -0,0 +1,20 @@
const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
const data = gm(image.data).resize("512x512!");
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {
file: resultBuffer,
name: `stretch.${image.type}`
});
};
exports.aliases = ["aspect", "ratio", "aspect43", "43"];
exports.category = 5;
exports.help = "Stretches an image to 4:3 aspect ratio";

View file

@ -49,6 +49,7 @@ exports.run = async (message, args) => {
"text": `Page ${i + 1} of ${groups.length}`
},
"description": value.join("\n"),
"fields": [process.env.NODE_ENV === "development" ? {"name": "Note", "value": "Tags created in this version of esmBot will not carry over to the final release."} : null],
"author": {
"name": message.author.username,
"icon_url": message.author.avatarURL

24
commands/wide.js Normal file
View file

@ -0,0 +1,24 @@
const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
gm(image.data).size(async (error, size) => {
if (error) throw error;
const data = gm(image.data).resize(`${(size.width * 19) / 2}x${size.height / 2}!`);
//.gravity("Center").extent(size.width, size.height)
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {
file: resultBuffer,
name: `wide.${image.type}`
});
});
};
exports.aliases = ["w19", "wide19"];
exports.category = 5;
exports.help = "Stretches an image to 19x its width";

View file

@ -1,6 +1,6 @@
{
"name": "esmbot",
"version": "2.0.0",
"version": "1.0.0",
"description": "A Discord bot with miscellaneous features",
"main": "app.js",
"engines": {