Skip to content

Commit

Permalink
Changed file info type
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard7377 authored and wizard7377 committed Aug 12, 2023
1 parent dadb962 commit f1f0da2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion include/dpp/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ struct end_msg_t {};
*/
struct end_row_t {};

/**
* @brief Simple wrapper for file info
*
*/
struct file_info {
std::string file_name;
std::string file_content;
std::string mime_type;
};
/**
* @brief End and send a message in stream
*
Expand Down Expand Up @@ -89,7 +98,7 @@ class DPP_EXPORT base_stream {
* @param f Pair of filename and filecontent to add
* @return This stream, for purposes of chaining
*/
base_stream& operator<<(const std::pair<std::string,std::string> &f);
base_stream& operator<<(const file_info &f);
virtual void send(command_completion_event_t callback = utility::log_error()) = 0;
virtual message send_sync() = 0;
message msg = message();
Expand Down
6 changes: 4 additions & 2 deletions src/dpp/streams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ end_row_t end_row() {
return {};
}



channel_stream::channel_stream(cluster& bot_, const channel& out_channel) : bot(&bot_), out_channel_id(out_channel.id) {}

channel_stream::channel_stream(cluster& bot_, snowflake out_channel_id_) : bot(&bot_), out_channel_id(out_channel_id_) {}
Expand Down Expand Up @@ -83,8 +85,8 @@ base_stream& base_stream::operator<<(const component& c) {
}


base_stream& base_stream::operator<<(const std::pair<std::string,std::string> &f) {
this->msg.add_file(f.first,f.second);
base_stream& base_stream::operator<<(const file_info &f) {
this->msg.add_file(f.file_name,f.file_content,f.mime_type);
return (*this);
}

Expand Down

0 comments on commit f1f0da2

Please sign in to comment.