diff --git a/include/dpp/streams.h b/include/dpp/streams.h index 91d1c4c425..bf6c1caf9d 100644 --- a/include/dpp/streams.h +++ b/include/dpp/streams.h @@ -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 * @@ -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 &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(); diff --git a/src/dpp/streams.cpp b/src/dpp/streams.cpp index 7055bac3bd..8f0e0722b9 100644 --- a/src/dpp/streams.cpp +++ b/src/dpp/streams.cpp @@ -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_) {} @@ -83,8 +85,8 @@ base_stream& base_stream::operator<<(const component& c) { } -base_stream& base_stream::operator<<(const std::pair &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); }