Code Monkey home page Code Monkey logo

Comments (7)

aiko-chan-ai avatar aiko-chan-ai commented on May 19, 2024 2

Is that a yes 😆 I don't want to submit a PR if you're already working on something.

I'm working on interactions at the moment, so you can submit a PR .-.

from discord.js-selfbot-v13.

SpeedyCraftah avatar SpeedyCraftah commented on May 19, 2024 1

Update: It's actually more complex for guilds! For guilds users receive the threads via the GUILD_CREATE event you receive upon startup, probably because users always cache channels and guilds unlike bots which can be picky about what they cache. I'll probably create a new object on the guild class which gets populated on startup and also is modified through events such as thread create/thread delete etc.

For channels it's really simple, there's an API call for it.

Not a massive problem but it does add more complexity when keeping the project up-to-date with the discord.js branch, especially when you still want to maintain support for bots where you need to add extra checks.

from discord.js-selfbot-v13.

aiko-chan-ai avatar aiko-chan-ai commented on May 19, 2024

Issue description

It seems that ThreadManager.fetchActive is a bot-only endpoint. The Discord client uses the search API endpoint for the threads dropdown. This may also apply to fetchArchived.

      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Only bots can use this endpoint
    at RequestHandler.execute ([redacted]/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:350:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push ([redacted]/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:51:14)
    at async ThreadManager.fetchActive ([redacted]/node_modules/discord.js-selfbot-v13/src/managers/ThreadManager.js:234:17) {
  method: 'get',
  path: '/guilds/[redacted]/threads/active',
  code: 20002,
  httpStatus: 403,
  requestData: { json: undefined, files: [] }
}

Code sample

// Fails with "DiscordAPIError: Only bots can use this endpoint"
const activeThreads = await channel.threads.fetchActive();

Package version

2.0.4

Node.js version

18

Operating system

No response

Priority this issue should have

Medium (should be fixed soon)

Checklist

  • I have searched the open issues for duplicates.
  • I have shared the entire traceback.
  • I am using a user token (and it isn't visible in the code).

Additional Information

No response

I will block this endpoint, thank you for informing me
I will find another endpoint with similar functionality

from discord.js-selfbot-v13.

SpeedyCraftah avatar SpeedyCraftah commented on May 19, 2024

It appears users use a special endpoint for this: https://discord.com/api/v9/channels/*************/threads/search?archived=true&sort_by=last_message_time&sort_order=desc&limit=25&offset=0 (grabbed this from network logs) so you can probably set the archived to false to get active threads. I can submit a PR if @aiko-chan-ai is happy for me to do so.

from discord.js-selfbot-v13.

aiko-chan-ai avatar aiko-chan-ai commented on May 19, 2024

It appears users use a special endpoint for this: https://discord.com/api/v9/channels/*************/threads/search?archived=true&sort_by=last_message_time&sort_order=desc&limit=25&offset=0 (grabbed this from network logs) so you can probably set the archived to false to get active threads. I can submit a PR if @aiko-chan-ai is happy for me to do so.

ty <3

from discord.js-selfbot-v13.

SpeedyCraftah avatar SpeedyCraftah commented on May 19, 2024

It appears users use a special endpoint for this: https://discord.com/api/v9/channels/*************/threads/search?archived=true&sort_by=last_message_time&sort_order=desc&limit=25&offset=0 (grabbed this from network logs) so you can probably set the archived to false to get active threads. I can submit a PR if @aiko-chan-ai is happy for me to do so.

ty <3

Is that a yes 😆 I don't want to submit a PR if you're already working on something.

from discord.js-selfbot-v13.

SpeedyCraftah avatar SpeedyCraftah commented on May 19, 2024

Update: It's actually more complex for guilds! For guilds users receive the threads via the GUILD_CREATE event you receive upon startup, probably because users always cache channels and guilds unlike bots which can be picky about what they cache. I'll probably create a new object on the guild class which gets populated on startup and also is modified through events such as thread create/thread delete etc.

For channels it's really simple, there's an API call for it.

Not a massive problem but it does add more complexity when keeping the project up-to-date with the discord.js branch, especially when you still want to maintain support for bots where you need to add extra checks.

(I have no idea where I got guilds from when the issue stems from fetching channel threads but this could be a future thing!)

from discord.js-selfbot-v13.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.