Allow editing of message's embeds

This commit is contained in:
SeanOMik 2020-06-21 00:13:54 -05:00
parent b40fe05df4
commit 1b4fcaaa79
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 7 additions and 3 deletions

View File

@ -271,10 +271,14 @@ proc removeAllReactions*(message: Message, emoji: Emoji) {.async.} =
"/reactions/" & emoji.toUrlEncoding()), HttpDelete, defaultHeaders(), message.channelID,
RateLimitBucketType.channel)
#TODO: Embeds and maybe flags?
proc editMessage*(message: Message, content: string): Future[Message] {.async.} =
#TODO: Maybe allow editing of message flags?
proc editMessage*(message: Message, content: string, embed: Embed = nil): Future[Message] {.async.} =
## Edit a previously sent message.
let jsonBody = %*{"content": content}
var jsonBody = %*{"content": content}
if (not embed.isNil()):
jsonBody.add("embed", embed.embedJson)
return newMessage(sendRequest(endpoint("/channels/" & $message.channelID & "/messages/" & $message.id),
HttpPatch, defaultHeaders(newHttpHeaders({"Content-Type": "application/json"})),
message.channelID, RateLimitBucketType.channel, jsonBody))