Git Product home page Git Product logo

Comments (3)

bwmarrin avatar bwmarrin commented on May 20, 2024
  • what the hell is GUILD_MEMBERS_CHUNK
  • if you have large_threshold enabled, you can send an opcode to request all the users that were withheld from you
  • if you own a server with > 100 members, and you open the members settings page, you can see it when the # of members jumps up
    GUILD_MEMBERS_CHUNK is a bit more interesting than that
    4:09 PMVoltanayeah I noticed there was a query and limit field to that opcode
    4:09 PMVoltanabut I didnt see the client using them
    4:09 PMReactit does
    4:10 PMReactin the DM window
    4:10 PMReactwhen u hit the +
    4:10 PMReactthat's how it grabs the full list of users
    4:10 PMReactand queries it
    4:10 PMVoltanabut if you already downloaded all users, why query?
    4:10 PMReacti think optimization should be done
    4:10 PMReactbut its not right now lol
    4:10 PMVoltanalol
    4:10 PMDannyhow does MEMBERS_CHUNK work anyway
    4:10 PMReactu send opcode 8
    4:10 PMDannydo you request it
    4:11 PMReactand u get back a members chunk
    4:11 PMDannyah okay
    4:11 PMReactand u update ur member list

from discordgo.

bwmarrin avatar bwmarrin commented on May 20, 2024

More info

Danny - Today at 10:31 PM
so what you have to do is request for chunking (i.e. send to the websocket)
for the servers you want to get the offline members for
the servers that require chunking have a boolean property called large on ready
the chunking format is
{
    'op': 8,
    'd': {
        'guild_id': [ guild id list of servers],
        'query': '',
        'limit': 0
    }
}
you send this to the websocket
afterwards you will get GUILD_MEMBERS_CHUNK events (receive)
that are paginated at 1000 members per chunk
you can know when to stop with a new property
member_count in the guild
e.g. a member_count of 2531 means that you'll get 3 GUILD_MEMBERS_CHUNK
1000, 1000, and 531
note that these chunks also include online members

from discordgo.

bwmarrin avatar bwmarrin commented on May 20, 2024
Danny - Today at 10:36 PM
you will also require chunking for joining guilds @Skippy
in GUILD_CREATE
if large == true

So when you join a guild and it returns the guild info event, if it's large enough, offline members will not be included and we'll need to use the chunking op to fetch them.

from discordgo.

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.