aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
698 stars 143 forks source link

Selfbot: Is it possible to get all of a guild's threads? #1137

Closed DominosCinnaStix closed 1 day ago

DominosCinnaStix commented 2 months ago

Which package is the feature request for?

The core library

Feature

It seems that only bot accounts can use the fetch active threads.

The only other selfbot solution appears to be sending an API request for EVERY text channel to get its threads. Now this can be problematic when you don't know which channel will have the threads because it'll be a lot of requests in a short time span.

Ideal solution or implementation

Does anyone know if there's a less API-spammy way to get all active/archived threads? I guess, can we figure out which text channels does have threads? Then I could only fetch those. What does the discord client do?

Alternative solutions or implementations

No response

Other context

No response

TheDevYellowy commented 2 months ago

if you fetch messages there is a type, type 18 is a thread ( idk if it's active or not I couldn't find a not active one to test on ).

{
  "attachments": [],
  "author": {},
  "channel_id": "",
  "components": [],
  "content": "", // ( the name of the thread )
  "edited_timestamp": null | "",
  "embeds": [],
  "flags": 0,
  "id": "",
  "mention_everyone": false,
  "mention_roles": [],
  "mentions": [],
  "message_reference": {},
  "pinned": false,
  "thread": {}, // data about the thread
  "timestamp": "",
  "tts": false,
  "type": 18
}
DominosCinnaStix commented 2 months ago

if you fetch messages there is a type, type 18 is a thread ( idk if it's active or not I couldn't find a not active one to test on ).

{
  "attachments": [],
  "author": {},
  "channel_id": "",
  "components": [],
  "content": "", // ( the name of the thread )
  "edited_timestamp": null | "",
  "embeds": [],
  "flags": 0,
  "id": "",
  "mention_everyone": false,
  "mention_roles": [],
  "mentions": [],
  "message_reference": {},
  "pinned": false,
  "thread": {}, // data about the thread
  "timestamp": "",
  "tts": false,
  "type": 18
}

Mhmm, but this would lead to sending even more API requests just to figure out which channels have threads. I'd have to repeatedly fetch messages from all text based channels, which doesn't sound friendly to Discord' API

DominosCinnaStix commented 2 months ago

Hmm, I decided to look at DevTools when running Discord. I saw that Discord is able to get the small menu list when hovering over a channel that has threads WITHOUT sending an API request. I looked at the WS events it sends and by sending

{
    "op": 37,
    "d": {
        "subscriptions": {
            "GUILD_ID": {
                "typing": true,
                "activities": true,
                "threads": true
            }
        }
    }
}

the client recieves a THREAD_LIST_SYNC that contains thread objects in that guild. I don't know if theres a limit on how many it sends, but it is definitely enough for me.

aiko-chan-ai commented 2 weeks ago

I will implement it

aiko-chan-ai commented 1 day ago

v3.2.0 🎉