diff --git a/api/index.js b/api/index.js
index e83e089..128b216 100644
--- a/api/index.js
+++ b/api/index.js
@@ -138,7 +138,7 @@ server.listen(8080, () => {
});
const runJob = (job, sock) => {
- return new Promise(async (resolve, reject) => {
+ return new Promise((resolve, reject) => {
log(`Job ${job.uuid} starting...`, job.num);
const object = JSON.parse(job.msg);
@@ -148,17 +148,16 @@ const runJob = (job, sock) => {
}
log(`Job ${job.uuid} started`, job.num);
- try {
- const { buffer, fileExtension } = await run(object);
+ run(object).then((data) => {
log(`Sending result of job ${job.uuid} back to the bot`, job.num);
- jobs[job.uuid].data = buffer;
- jobs[job.uuid].ext = fileExtension;
+ jobs[job.uuid].data = data.buffer;
+ jobs[job.uuid].ext = data.fileExtension;
sock.write(Buffer.concat([Buffer.from([0x1]), Buffer.from(job.uuid)]), (e) => {
if (e) return reject(e);
return resolve();
});
- } catch (e) {
+ }).catch(e => {
reject(e);
- }
+ });
});
};
\ No newline at end of file
diff --git a/commands/emote.js b/commands/emote.js
index 3139f00..7925d3e 100644
--- a/commands/emote.js
+++ b/commands/emote.js
@@ -1,9 +1,9 @@
const emojiRegex = require("emoji-regex");
-exports.run = async (message, args) => {
+exports.run = async (message, args, content) => {
if (args.length === 0) return `${message.author.mention}, you need to provide an emoji!`;
- if (args[0].match(/^$/)) {
- return `https://cdn.discordapp.com/emojis/${args[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${args[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
+ if (content.split(" ")[0].match(/^$/)) {
+ return `https://cdn.discordapp.com/emojis/${content.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${content.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
} else if (args[0].match(emojiRegex)) {
const codePoints = [];
for (const codePoint of args[0]) {
diff --git a/events/messageCreate.js b/events/messageCreate.js
index 4600c81..5289b0a 100644
--- a/events/messageCreate.js
+++ b/events/messageCreate.js
@@ -70,7 +70,7 @@ module.exports = async (message) => {
try {
await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command);
const startTime = new Date();
- const result = await cmd(message, args, content.replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy
+ const result = await cmd(message, args, message.content.substring(prefix.length).trim().replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy
const endTime = new Date();
if (typeof result === "string" || (typeof result === "object" && result.embed)) {
await client.createMessage(message.channel.id, result);