add ability to edit messages

This commit is contained in:
ouwou
2020-08-30 22:55:36 -04:00
parent 44b7989f50
commit 9b1bc8f145
12 changed files with 120 additions and 1 deletions

View File

@@ -172,6 +172,14 @@ void DiscordClient::DeleteMessage(Snowflake channel_id, Snowflake id) {
m_http.MakeDELETE(path, [](auto) {});
}
void DiscordClient::EditMessage(Snowflake channel_id, Snowflake id, std::string content) {
std::string path = "/channels/" + std::to_string(channel_id) + "/messages/" + std::to_string(id);
MessageEditObject obj;
obj.Content = content;
nlohmann::json j = obj;
m_http.MakePATCH(path, j.dump(), [](auto) {});
}
void DiscordClient::UpdateToken(std::string token) {
m_token = token;
m_http.SetAuth(token);