Add files via upload
This commit is contained in:
17
bot/commands/deleteFile.js
Normal file
17
bot/commands/deleteFile.js
Normal file
@ -0,0 +1,17 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
command: 'df',
|
||||
description: 'Delete a file from your webserver (https://{domain}/{fileName})',
|
||||
syntax: '{PREFIX}df [fileName]',
|
||||
execute: async (_this, msg, args) => {
|
||||
if (!args.join(' ')) return msg.channel.createMessage('No arguments were given');
|
||||
const fileName = args.join(' ');
|
||||
const filesDir = `${__dirname}/../../server/uploads`;
|
||||
fs.unlink(`${filesDir}/${fileName}`, err => {
|
||||
err
|
||||
? msg.channel.createMessage(`Error deleting file: ${fileName}\n${err}`)
|
||||
: msg.channel.createMessage(`Successfully Deleted File: ${fileName}`);
|
||||
});
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user