Ping the user when a response takes over 3 minutes, added config option for specifying a custom 8mb image domain
This commit is contained in:
parent
4d5ef3c24f
commit
45bb53d521
2 changed files with 9 additions and 4 deletions
|
@ -45,6 +45,8 @@ CHROME=172.17.0.1:9222
|
||||||
OUTPUT=
|
OUTPUT=
|
||||||
# Put temporary image dir here (make sure it's accessible via a web server), leave blank to disable
|
# Put temporary image dir here (make sure it's accessible via a web server), leave blank to disable
|
||||||
TEMPDIR=
|
TEMPDIR=
|
||||||
|
# Put temporary image web server domain
|
||||||
|
TMP_DOMAIN=
|
||||||
|
|
||||||
# Set this to true if you're using PM2 to manage the bot
|
# Set this to true if you're using PM2 to manage the bot
|
||||||
PMTWO=false
|
PMTWO=false
|
||||||
|
|
|
@ -69,7 +69,9 @@ module.exports = async (message) => {
|
||||||
logger.log("info", `${message.author.username} (${message.author.id}) ran command ${command}`);
|
logger.log("info", `${message.author.username} (${message.author.id}) ran command ${command}`);
|
||||||
try {
|
try {
|
||||||
await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command);
|
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, content.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)) {
|
if (typeof result === "string" || (typeof result === "object" && result.embed)) {
|
||||||
await client.createMessage(message.channel.id, result);
|
await client.createMessage(message.channel.id, result);
|
||||||
} else if (typeof result === "object" && result.file) {
|
} else if (typeof result === "object" && result.file) {
|
||||||
|
@ -80,17 +82,18 @@ module.exports = async (message) => {
|
||||||
embed: {
|
embed: {
|
||||||
color: 16711680,
|
color: 16711680,
|
||||||
title: "Here's your image!",
|
title: "Here's your image!",
|
||||||
url: `https://projectlounge.pw/tmp/${filename}`,
|
url: `${process.env.TMP_DOMAIN == "" ? "https://projectlounge.pw/tmp" : process.env.TMP_DOMAIN}/${filename}`,
|
||||||
image: {
|
image: {
|
||||||
url: `https://projectlounge.pw/tmp/${filename}`
|
url: `${process.env.TMP_DOMAIN == "" ? "https://projectlounge.pw/tmp" : process.env.TMP_DOMAIN}/${filename}`
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
text: "The result image was more than 8MB in size, so it was uploaded to an external site instead."
|
text: "The result image was more than 8MB in size, so it was uploaded to an external site instead."
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
content: (endTime - startTime) >= 180000 ? message.author.mention : undefined
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await client.createMessage(message.channel.id, result.text ? result.text : "", result);
|
await client.createMessage(message.channel.id, result.text ? result.text : ((endTime - startTime) >= 180000 ? message.author.mention : undefined), result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue