Skip to content

Commit daef6bc

Browse files
committed
get message by id
1 parent ccba23a commit daef6bc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Discord.C++/TextChannel.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "TextChannel.h"
22

3-
#include "Channel.h"
4-
#include "DiscordObject.h"
53
#include "Embed.h"
64
#include "Exceptions.h"
75
#include "Message.h"
@@ -49,6 +47,12 @@ DiscordCPP::Message DiscordCPP::TextChannel::send(DiscordCPP::Embed embed) {
4947
return {api_call(url, "POST", data, "application/json"), get_token()};
5048
}
5149

50+
/// @param[in] message_id Message ID
51+
DiscordCPP::Message DiscordCPP::TextChannel::get_message(const std::string& message_id) {
52+
std::string url = "/channels/" + get_id() + "/messages/" + message_id;
53+
return Message(api_call(url), get_token());
54+
}
55+
5256
/** @param[in] limit Max number of messages to retrieve (1-100)
5357
@param[in] before Get messages before this message id
5458
@param[in] after Get messages after this message id

Discord.C++/TextChannel.h

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class TextChannel : public Channel {
3333
/// Send an Embed to this channel.
3434
DLL_EXPORT Message send(Embed embed);
3535

36+
/// Get message by id
37+
DLL_EXPORT Message get_message(const std::string& message_id);
3638
/// Get messages from channel history
3739
DLL_EXPORT std::vector<std::shared_ptr<Message>> history(const int limit = 100, const std::string& before = "", const std::string& after = "", const std::string& around = "");
3840

0 commit comments

Comments
 (0)