Skip to content

Commit

Permalink
added stage attribute to dpp::invite
Browse files Browse the repository at this point in the history
  • Loading branch information
Commandserver committed Feb 13, 2022
1 parent c4e8fcc commit 48612f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ class DPP_EXPORT cluster {
* @note This method supports audit log reasons set by the cluster::set_audit_reason() method.
* @param invite Invite code to delete
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error().
* On success the callback will contain a dpp::invite object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error().
*/
void invite_delete(const std::string &invite, command_completion_event_t callback = {});

Expand Down
4 changes: 4 additions & 0 deletions include/dpp/invite.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <dpp/export.h>
#include <dpp/snowflake.h>
#include <dpp/json_fwd.hpp>
#include <dpp/stage_instance.h>
#include <unordered_map>

namespace dpp {
Expand Down Expand Up @@ -75,6 +76,9 @@ class DPP_EXPORT invite {
* @note Only set when using cluster::channel_invites_get
*/
uint32_t uses;
/** The stage instance data if there is a public stage instance in the stage channel this invite is for
*/
stage_instance stage;

/** Constructor
*/
Expand Down
3 changes: 3 additions & 0 deletions src/dpp/invite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ invite& invite::fill_from_json(nlohmann::json* j) {
temporary = bool_not_null(j, "temporary");
unique = bool_not_null(j, "unique");
uses = (j->find("uses") != j->end()) ? int32_not_null(j, "uses") : 0;
if (j->find("stage_instance") != j->end()) {
stage = stage_instance().fill_from_json(&((*j)["stage_instance"]));
}
return *this;
}

Expand Down

0 comments on commit 48612f5

Please sign in to comment.