Added toggle for temporary image storage
This commit is contained in:
parent
af8bce1d3e
commit
881dfd34d7
2 changed files with 4 additions and 2 deletions
|
@ -43,9 +43,9 @@ module.exports = async (message) => {
|
|||
if (typeof result === "string" || (typeof result === "object" && result.embed)) {
|
||||
await client.createMessage(message.channel.id, result);
|
||||
} else if (typeof result === "object" && result.file) {
|
||||
if (result.file.length > 8388119) {
|
||||
if (result.file.length > 8388119 && process.env.TEMPDIR !== "") {
|
||||
const filename = `${Math.random().toString(36).substring(2, 15)}.${result.name.split(".")[1]}`;
|
||||
await promisify(fs.writeFile)(`/var/www/html/tmp/${filename}`, result.file);
|
||||
await promisify(fs.writeFile)(`${process.env.TEMPDIR}/${filename}`, result.file);
|
||||
await client.createMessage(message.channel.id, {
|
||||
embed: {
|
||||
color: 16711680,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue