forscht / ddrive

Discord as a filesystem.
https://ddrive.forscht.dev
MIT License
490 stars 98 forks source link

[Feature Request] User accounts instead of a bot for fearless people? #19

Closed sidanya closed 2 years ago

sidanya commented 2 years ago

Of course, this is extremely dangerous, but instead of 7 or 14 boosts in the server, the user only needs to have a nitro to increase the maximum file size.

forscht commented 2 years ago

You can just replace bot token with user token and it will work just fine.

sidanya commented 2 years ago

But it gives an error 401 (the channel id and my token are valid)

discordFS >>> booting discordFS +0ms
/root/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:287
        throw new DiscordAPIError.DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
              ^

DiscordAPIError[0]: 401: Unauthorized
    at SequentialHandler.runRequest (/root/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:287:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/root/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14)
    at async REST.request (/root/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22)
    at async DiscordFS.load (/root/node_modules/@forscht/ddrive/src/discordFS/index.js:59:31)
    at async run (/root/run.js:22:5) {
  rawError: { message: '401: Unauthorized', code: 0 },
  code: 0,
  status: 401,
  method: 'GET',
  url: 'https://discord.com/api/v10/channels/(hidden)/messages?limit=100',
  requestBody: { files: undefined, json: undefined }
}

upd: i also tried using a group id with one user and it didn't work either

forscht commented 2 years ago

Do you have 2FA enabled? How did you extract user token?

sidanya commented 2 years ago

No, 2FA is off. Used this guide

forscht commented 2 years ago

Hi @idanyas , Thanks for bringing this up. To use the user token you will need to add one option in discordFS. I have updated README example. Please test your account with README example and let me know if you're still facing issue.

forscht commented 2 years ago

https://github.com/forscht/ddrive#api-usage

sidanya commented 2 years ago

Thanks, it works now.