Add files via upload

This commit is contained in:
2021-08-18 00:12:37 -07:00
committed by GitHub
parent ecd6246099
commit 9d759573d2
55 changed files with 3098 additions and 0 deletions

19
bot/commands/rename.js Normal file
View File

@ -0,0 +1,19 @@
const fs = require('fs');
module.exports = {
command: 'rn',
description: 'Rename an upload',
syntax: '{PREFIX}rn [old fileName], [new file name]',
execute: async (_this, msg, args) => {
// eslint-disable-next-line no-useless-escape
const files = args.join(' ').split(/\, ?/);
if (!files[0]) return msg.channel.createMessage('Supply a file name');
if (!files[1]) return msg.channel.createMessage('Supply a new file name');
const filesDir = `${__dirname}/../../server/uploads`;
fs.rename(`${filesDir}/${files[0]}`, `${filesDir}/${files[1]}`, err => {
err
? msg.channel.createMessage(`Error renaming file: ${files[0]}\n${err}`)
: msg.channel.createMessage(`Successfully Renamed File: ${files[1]}`);
});
},
};