Skip to content

Conversation

switchupcb
Copy link
Owner

This pull request updates Disgo to the current Discord API with v7 Voice Connection logic.

More information is explained in an upcoming issue.

@switchupcb
Copy link
Owner Author

The following tests fail due to timeouts.

  • TestRequestRouteRateLimit
  • TestRequestGlobalRateLimit

@switchupcb
Copy link
Owner Author

switchupcb commented Feb 16, 2025

Update: The rate limit test has an issue, but the problem is Discord's rate limit headers.

{
    "level": "info",
    "time": "2025-02-15T21:24:48.4587733-06:00",
    "client": "",
    "request": {
        "xid": "cuolkvv5ohdj087k30e0",
        "route": "178",
        "resource": "",
        "endpoint": "https://discord.com/api/v10/users/990803528735932476"
    },
    "response": {
        "header": "HTTP/1.1 200 OK\r\nServer: cloudflare\r\nDate: Sun, 16 Feb 2025 03:24:47 GMT\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\nX-Ratelimit-Bucket: 06f50622af95a11ccfb8304b866ed5b0\r\nX-Ratelimit-Limit: 2000\r\nX-Ratelimit-Remaining: 1980\r\nX-Ratelimit-Reset: 1739676288.766\r\nX-Ratelimit-Reset-After: 0.573\r\nVary: Accept-Encoding\r\nVia: 1.1 google\r\nAlt-Svc: h3=\":443\"; ma=86400\r\nCf-Cache-Status: BYPASS\r\nReport-To: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=zJB8V4hGmhuuq%2FI8PQJ%2BMXPTuEHjfYiZXYvyYZbH3zfWrTpESSrVLId9FoPOy%2FAov3KEERaiO1XfEBdOCeuqd505vxzGgLDftNdLk7GwLDixjsO5UML%2FUtkl3%2B3y\"}],\"group\":\"cf-nel\",\"max_age\":604800}\r\nNel: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\r\nX-Content-Type-Options: nosniff\r\nReporting-Endpoints: csp-sentry=\"https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable\"\r\nContent-Security-Policy: frame-ancestors 'none'; default-src https://o64374.ingest.sentry.io; report-to csp-sentry; report-uri https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable\r\nCf-Ray: 912a6d409e136b28-DFW\r\nSet-Cookie: __dcfduid=9353bed0ec1511efac16621e9a5eced7; Expires=Fri, 15-Feb-2030 03:24:48 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax\r\nSet-Cookie: __sdcfduid=9353bed0ec1511efac16621e9a5eced75fe455f6d64a479c7ab42c8b932a04e79b34eaa1e37f50ad6c43efe94abd9d80; Expires=Fri, 15-Feb-2030 03:24:48 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax\r\nSet-Cookie: __cfruid=2b175f63f811e215849f19f1df67bfd9f39e6da5-1739676288; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None\r\nSet-Cookie: _cfuvid=HOF6rpJVgjW9ishjcOXvq.0h1z9ga4zGgTR3GuaazO0-1739676288226-0.0.1.1-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None\r\n\r\n",
        "body": "{\"id\":\"990803528735932476\",\"username\":\"Disgo\",\"avatar\":null,\"discriminator\":\"0521\",\"public_flags\":0,\"flags\":0,\"bot\":true,\"banner\":null,\"accent_color\":null,\"global_name\":null,\"avatar_decoration_data\":null,\"banner_color\":null,\"clan\":null,\"primary_guild\":null}\n"
    }
}
ratelimit_test.go: 109: Request 21 : &{<nil> <nil> <nil> <nil> <nil> 0xc000714793 <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> Disgo 0521 990803528735932476
}
{
    "level": "info",
    "time": "2025-02-15T21:24:48.4797313-06:00",
    "client": "",
    "request": {
        "xid": "cuolkvv5ohdj087k30g0",
        "route": "178",
        "resource": "",
        "endpoint": "https://discord.com/api/v10/users/990803528735932476"
    },
    "response": {
        "header": "HTTP/1.1 429 Too Many Requests\r\nServer: cloudflare\r\nDate: Sun, 16 Feb 2025 03:24:47 GMT\r\nContent-Type: application/json\r\nContent-Length: 80\r\nConnection: keep-alive\r\nRetry-After: 30\r\nX-Ratelimit-Scope: user\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\nX-Ratelimit-Bucket: 481e0bf1883da82f2e83411bc2da9c89\r\nX-Ratelimit-Limit: 30\r\nX-Ratelimit-Remaining: 0\r\nX-Ratelimit-Reset: 1739676317.636\r\nX-Ratelimit-Reset-After: 29.320\r\nVia: 1.1 google\r\nAlt-Svc: h3=\":443\"; ma=86400\r\nCf-Cache-Status: BYPASS\r\nReport-To: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=X4X9ltfzw9b3U%2BZSSrUTdlnMtEEl8Lezn0qGZ%2Bx3g83DC%2B5eW7rUCKvvPHi90oQLM03I5HZCSmkjHmN8S4OkwFmnPkiWA4Q36FC%2FHGm670S2715qzTOD5jtCZDxk\"}],\"group\":\"cf-nel\",\"max_age\":604800}\r\nNel: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\r\nX-Content-Type-Options: nosniff\r\nReporting-Endpoints: csp-sentry=\"https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable\"\r\nContent-Security-Policy: frame-ancestors 'none'; default-src https://o64374.ingest.sentry.io; report-to csp-sentry; report-uri https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable\r\nCf-Ray: 912a6d409e8f6b2e-DFW\r\nSet-Cookie: __dcfduid=9365cefeec1511ef8db4ea765ce5924d; Expires=Fri, 15-Feb-2030 03:24:48 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax\r\nSet-Cookie: __sdcfduid=9365cefeec1511ef8db4ea765ce5924d8d3961230b87e1e1defd63a60e2ae503fc7e048d7c9422c67e83d07d4c80bfd5; Expires=Fri, 15-Feb-2030 03:24:48 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax\r\nSet-Cookie: __cfruid=2b175f63f811e215849f19f1df67bfd9f39e6da5-1739676288; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None\r\nSet-Cookie: _cfuvid=ikdPYMySeqmQTIq5QmstGwzr9uXP0gYXFkR951cjOqs-1739676288341-0.0.1.1-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None\r\n\r\n",
        "body": "{\"message\": \"You are being rate limited.\", \"retry_after\": 0.32, \"global\": false}"
    }
}

How does it go from 1980 remaining to 0?

discord/discord-api-docs#7394

@switchupcb switchupcb merged commit 299ac00 into v10 Feb 16, 2025
7 of 8 checks passed
@switchupcb switchupcb deleted the voice branch February 16, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant