brokenprogrammer / BrokenDiscord

Discord Library written in F#
MIT License
7 stars 0 forks source link

EditMessage returns HTTP 400 response #26

Closed brokenprogrammer closed 6 years ago

brokenprogrammer commented 6 years ago

Used a small testing bot but its unable to edit its own messages. I'm putting this on hold for now or incase someone else wants to attempt to fix the issue.

According to the discord api:

400 (BAD REQUEST) | The request was improperly formatted, or the server couldn't understand it

The following request uri was used:

https://discordapp.com/api/channels/481177024707428372/messages/487528139518377995

Which doesn't seem to be a problem.

And the json body sent as a test looks like the following:

{"content":"Test Message","embed":null}

Together with the alternative:

{"content":"Test Message"}

Documentation for Edit Message is available here: https://discordapp.com/developers/docs/resources/channel#edit-message

This issue seems to also affect the following (The ones I know of):

kavorite commented 6 years ago

You get the ApiError off the response handler I wrote? That might be worth introspecting on

On Fri, Sep 7, 2018, 04:33 Oskar Mendel notifications@github.com wrote:

Used a small testing bot but its unable to edit its own messages. I'm putting this on hold for now or incase someone else wants to attempt to fix the issue.

According to the discord api:

400 (BAD REQUEST) | The request was improperly formatted, or the server couldn't understand it

The following request uri was used:

https://discordapp.com/api/channels/481177024707428372/messages/487528139518377995

Which doesn't seem to be a problem.

And the json body sent as a test looks like the following:

{"content":"Test Message","embed":null}

Together with the alternative:

{"content":"Test Message"}

Documentation for Edit Message is available here: https://discordapp.com/developers/docs/resources/channel#edit-message

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brokenprogrammer/BrokenDiscord/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/APKSuElZf1uonNX6U7TCcTn3l6RYZM2pks5uYi9MgaJpZM4WeaAh .

kavorite commented 6 years ago

absolutely sure you're running a PATCH request?

On Fri, Sep 7, 2018, 04:33 Oskar Mendel notifications@github.com wrote:

Used a small testing bot but its unable to edit its own messages. I'm putting this on hold for now or incase someone else wants to attempt to fix the issue.

According to the discord api:

400 (BAD REQUEST) | The request was improperly formatted, or the server couldn't understand it

The following request uri was used:

https://discordapp.com/api/channels/481177024707428372/messages/487528139518377995

Which doesn't seem to be a problem.

And the json body sent as a test looks like the following:

{"content":"Test Message","embed":null}

Together with the alternative:

{"content":"Test Message"}

Documentation for Edit Message is available here: https://discordapp.com/developers/docs/resources/channel#edit-message

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brokenprogrammer/BrokenDiscord/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/APKSuElZf1uonNX6U7TCcTn3l6RYZM2pks5uYi9MgaJpZM4WeaAh .

brokenprogrammer commented 6 years ago

Yes I just double checked it is a PATCH request, This is the function:

    member this.EditMessage chid mgid (args : WebEditMessageParams) =
        restPatchCall<_,Message> token <| messageEndpoint chid mgid <| Some args

Called the following way using breakpoint on the res:

    let edit : WebEditMessageParams = {content = "Test edit"; embed = None}
    let res = client.EditMessage message.channelId message.id edit |> run

Returned is not the ApiError you wrote but and empty Result. The ErrorValue is null.

kavorite commented 6 years ago

And the toJson on that payload generated a valid body? No "None"s in there?

brokenprogrammer commented 6 years ago

Issue was a missing Content-Type header which was added: Here