discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Clarification about removal of nonce field in Channel->Create Message endpoint

Open MazeXP opened this issue 2 years ago • 8 comments

Description

The nonce field was removed from the Channel -> Create Message endpoint without any notice in following PR: #2859 The PR was not even closely related to thr nonce field at all.

Confusing is that most libraries are still providing access to this field even it is not documented anymore.

As well does the Message object still contain the nonce field.

Thereby I ask for clarification if the nonce field has been deprecated or was removed from the documentation by error.

Steps to Reproduce

Check documentation for Channel -> Create Message endpoint.

Expected Behavior

nonce being documented or stated that has been deprecated or removed from Channels->Create Message endpoint.

Current Behavior

nonce field is not documented for Channel->Create Message endpoint anymore

Screenshots/Videos

No response

Client and System Information

Browser: Google Chrome OS: Windows 10

MazeXP avatar Jun 17 '22 18:06 MazeXP

The nonce field is used for deduplication of messages by the client and has no effect on bot messages.

splatterxl avatar Jun 17 '22 18:06 splatterxl

I mean there could still be a use casenfor bots. I am just asking for a proper clarification why the field is not documented any more on the Channels -> Create Message endpoint.

For example discordjs is still listing it in their API types library: https://github.com/discordjs/discord-api-types/blob/main/rest/v10/channel.ts#L215

MazeXP avatar Jun 17 '22 18:06 MazeXP

the field is not part of our bot api. it is ignored for bots.

devsnek avatar Jun 17 '22 19:06 devsnek

I think it should also be used for deduplicating messages for bots, since the same problem happens with bots. When the request results in a bad gateway error, you have no way to know whether the message went through or not and have to retry or just hope. Why would this not be done for bots?

MinnDevelopment avatar Jun 17 '22 19:06 MinnDevelopment

the field is not part of our bot api. it is ignored for bots.

No it isn't.

image

This field is relatively useful for pairing a message received with a message sent for things like ping calculations or just other use cases where you'd want to do the pairing.

Rapptz avatar Jun 17 '22 19:06 Rapptz

ah i meant ignored for message send deduplication, which is the reason it exists in our api. if you just want it for identifying messages that could maybe be valid (feel free to open a pr) but its worth noting that the send message endpoint returns the created message with its id already.

devsnek avatar Jun 17 '22 19:06 devsnek

if you just want it for identifying messages that could maybe be valid

can nonce support be added to webhooks for this? #3396

advaith1 avatar Jun 18 '22 00:06 advaith1

ah i meant ignored for message send deduplication,

No way to guarantee deduplication for bots? Weird.

erkinalp avatar Jun 26 '22 14:06 erkinalp

Looks like this field doesn't make sense for bots at the moment. Please file a separate feature request if you have a legitimate use-case for the nonce field.

appellation avatar Sep 09 '22 18:09 appellation

Legitimate use-cases were brought up in the comments of this issue, and allegedly the nonce will be used to dedupe messages of bots on v11+.

MinnDevelopment avatar Sep 09 '22 18:09 MinnDevelopment

I agree that those use-cases merit discussion, but this issue is about the documentation which is currently accurate. While the API won't error if you send a nonce, there's no purpose in doing so.

If bot support gets added for v11+ then we can document it when that happens.

appellation avatar Sep 09 '22 20:09 appellation

I talked a bit more about this internally and it looks like we are continuing to support this without the deduplication functionality. My apologies for the confusion here, and thanks for calling it out! I'm going to leave this issue closed for now, but #5078 will be merged to fully resolve this.

appellation avatar Sep 09 '22 21:09 appellation

has nonce support been added to webhooks for pairing? if not, can that happen?

advaith1 avatar Sep 09 '22 22:09 advaith1