This commit is contained in:
split / May 2022-12-29 12:43:16 -08:00
parent 240d12d887
commit b8b891d9db
4 changed files with 11 additions and 4 deletions

View file

@ -3,5 +3,11 @@ File sharing via Discord
<br>
## .env
```
TOKEN=KILL-YOURSELF.NOW
```
## Disclaimer!
This project does some stuff that can be considered questionable. Discord may not like you uploading files this way, and it's a grey area in Discord's TOS. We take no responsibility if Discord locks your account for API abuse. This was made out of pure boredom and wondering if it was even possible.
This project does some stuff that can be considered questionable. Discord may not like you uploading files this way, and it's a grey area in Discord's TOS. We take no responsibility if Discord locks your account for API abuse.

View file

@ -1,6 +1,6 @@
{
"name": "monofile",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "index.js",
"scripts": {
@ -8,7 +8,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "Unlicense",
"engines": {
"node": "v16"
},

View file

@ -48,13 +48,14 @@ let uploadChannel:Discord.TextBasedChannel
interface FileUploadSettings {
name?: string,
mime: string,
uploadId?: string
}
let uploadFile = (settings:FileUploadSettings,fBuffer:Buffer) => {
return new Promise<string>(async (resolve,reject) => {
if (!settings.name || !settings.mime) {reject({status:400,message:"missing name/mime"});return}
let uploadId = Math.random().toString().slice(2)
let uploadId = settings.uploadId || Math.random().toString().slice(2)
if (files[uploadId]) {reject({status:500,message:"please try again"});return}
if (settings.name.length > 128) {reject({status:400,message:"name too long"}); return}

View file