discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.89k stars 1.25k forks source link

GUILD_MEMBER_ADD only working in smaller servers #6993

Closed Alyanos22 closed 4 weeks ago

Alyanos22 commented 1 month ago

Description

GUILD_MEMBER_ADD is only triggering when someone joins a smaller server - when its a bigger one nothing happens

Steps to Reproduce

 OkHttpClient client = new OkHttpClient();
        client.newWebSocket(new Request.Builder().url("wss://gateway.discord.gg/?v=10&encoding=json").build(), new WebSocketListener() {

            @Override
            public void onOpen(WebSocket webSocket, Response response) {
                webSocket.send(
                        new JSONObject() {{
                            put("op", 2);
                            put("d", new JSONObject() {{
                                put("token", token);
                                put("intents", 2);
                                put("properties", new JSONObject() {{
                                    put("$os", ...);
                                    put("$browser", ...);
                                    put("$device", ...);
                                }});
                            }});
                        }}.toString()
                );

                System.out.println(response);

                startPing(webSocket);
            }

            @Override
            public void onMessage(WebSocket webSocket, String text) {
                JSONObject jsonNode = new JSONObject(text);
                System.out.println(jsonNode.optString("t"));

                if (jsonNode.optString("t", "").equals("GUILD_MEMBER_ADD")) {
                    System.out.println(jsonNode);
                }
            }

            @Override
            public void onClosing(WebSocket webSocket, int code, String reason) {
                System.out.println("Closing: " + reason + " (" + code + ")");
                webSocket.close(1000, null);
                stopPing();
            }

            @Override
            public void onFailure(WebSocket webSocket, Throwable t, Response response) {
                t.printStackTrace();
                stopPing();
            }

        });

Expected Behavior

Its supposed to occur every time a user joins a discord guild

Current Behavior

it only triggers for smaller guilds (i dont know the limit)

Screenshots/Videos

You dont see anything - that is the problem.

Client and System Information

OkHttp, Windows 11

sklein12 commented 1 month ago

@Alyanos22 can you quantify bigger and smaller for me? How many members are in the larger server?

Alyanos22 commented 4 weeks ago

Hello @sklein12 with bigger i mean > 10k, I tested it with a guild where only I was in (there it worked) and a bigger server (10k), there it didn't work.

DV8FromTheWorld commented 4 weeks ago

I have just tested this in a server with >52,000 online users and I received the GUILD_MEMBER_ADD event. There is likely a bug in your setup somewhere.