Skip to content

Default to Discord API v10 for webhook requests #9

Description

@Rushaway

Problem

Webhook.Execute() and Webhook.Edit() send the caller's webhook URL to ripext unchanged:

Format(webhook_query, sizeof webhook_query, "%s?wait=true", webhook);
Format(webhook_patch, sizeof webhook_patch, "%s/messages/%s", webhook, messageId);

The webhook URL Discord gives you in the channel settings is unversioned:

https://discord.com/api/webhooks/{id}/{token}

Per the Discord API reference, omitting the version routes the request to the current default version, which is v6, and v6/v7/v8 are all marked Deprecated. Only v9 and v10 are "Available"; v10 is current.

Version Status Default
10 Available
9 Available
8 Deprecated
7 Deprecated
6 Deprecated

Discord has discontinued old API versions before, usually with limited notice. Whenever v6 is turned off, every plugin that feeds this include a bare webhook URL breaks at once, and server owners have no easy fix.

Proposal

Normalize the endpoint to an explicit version inside the include so it does not depend on Discord's default.

Sketch:

#define DISCORD_API_VERSION 10

// If the URL is a .../api/webhooks/... route with no /vNN/ segment,
// insert /v<DISCORD_API_VERSION>/ before "webhooks".
stock void NormalizeWebhookURL(const char[] in, char[] out, int maxlen)

Called from Execute() / Edit() before building the query/patch URL. A URL that already carries a version (/api/v10/webhooks/...) or a non-standard host would be left untouched, so callers keep full control.

Alternatives:

  • Just document that users should pass a versioned URL (weakest, easy to forget).
  • Expose the version as an overridable define only.

Notes

This is a behaviour change, so keeping it out of #8 (plain bug fixes). Happy to send a PR once we agree on the approach.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions