Skip to content

Commit

Permalink
Update upload.js
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealDax committed Nov 29, 2023
1 parent ffe255a commit 4274448
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion endpoints/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
* required: true
* schema:
* type: string
* - in: query
* name: name
* description: The name of the file to be uploaded. This is optional, and will default to "filename" if not specified.
* required: false
* schema:
* type: string
* - in: query
* name: message
* description: The message to be sent along with the file. This is optional, and will default to an empty message if not specified.
* required: false
* schema:
* type: string
* responses:
* '200':
* description: The file was successfully uploaded to the Discord channel.
Expand Down Expand Up @@ -69,14 +81,17 @@ const { fromBuffer } = require('file-type-cjs-fix/file-type');
MAX_FILE_SIZE = 1024 * 1024 * 8;

const upload = async (req, res) => {
try {
const { authorization: token } = req.headers;
const serverid = req.query.serverid;
const channelid = req.query.channelid;
const file = req.query.file;
const name = req.query.name || 'filename';
const message = req.query.message || '';

try {
if (!token) {
return res.status(400).json({ error: 'Missing Authorization header' });
}
const client = new Client({ intents });

client.login(token);
Expand Down

0 comments on commit 4274448

Please sign in to comment.