D++ (DPP)
C++ Discord API Bot Library
dpp::forum_tag Struct Reference

Represents a tag that is able to be applied to a thread in a forum or media channel. More...

#include <channel.h>

+ Inheritance diagram for dpp::forum_tag:
+ Collaboration diagram for dpp::forum_tag:

Public Member Functions

 forum_tag ()
 
 forum_tag (const std::string &name)
 Constructor. More...
 
virtual ~forum_tag ()=default
 
forum_tagset_name (const std::string &name)
 Set name of this forum_tag object. More...
 
constexpr double get_creation_time () const noexcept
 Get the creation time of this object according to Discord. More...
 
constexpr bool operator== (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 
constexpr bool operator!= (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 
forum_tagfill_from_json (nlohmann::json *j)
 Convert object from nlohmann::json. More...
 
auto to_json (bool with_id=false) const
 Convert object to nlohmann::json. More...
 
std::string build_json (bool with_id=false) const
 Convert object to json string. More...
 

Public Attributes

std::string name
 The name of the tag (0-20 characters). More...
 
std::variant< std::monostate, snowflake, std::string > emoji
 The emoji of the tag. Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji. More...
 
bool moderated
 Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission. More...
 
snowflake id = {}
 Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata. More...
 

Protected Member Functions

forum_tagfill_from_json_impl (nlohmann::json *j)
 Read struct values from a json object. More...
 
json to_json_impl (bool with_id=false) const
 Build json for this forum_tag object. More...
 

Friends

struct json_interface< forum_tag >
 

Detailed Description

Represents a tag that is able to be applied to a thread in a forum or media channel.

Constructor & Destructor Documentation

◆ forum_tag() [1/2]

dpp::forum_tag::forum_tag ( )

Constructor

◆ forum_tag() [2/2]

dpp::forum_tag::forum_tag ( const std::string &  name)

Constructor.

Parameters
nameThe name of the tag. It will be truncated to the maximum length of 20 UTF-8 characters.

◆ ~forum_tag()

virtual dpp::forum_tag::~forum_tag ( )
virtualdefault

Destructor

Member Function Documentation

◆ build_json()

std::string dpp::json_interface< forum_tag >::build_json ( bool  with_id = false) const
inlineinherited

Convert object to json string.

Parameters
with_idWhether to include the ID or not
Note
Some fields are conditionally filled, do not rely on all fields being present
Returns
std::string Json built from the structure

◆ fill_from_json()

forum_tag & dpp::json_interface< forum_tag >::fill_from_json ( nlohmann::json *  j)
inlineinherited

Convert object from nlohmann::json.

Parameters
jnlohmann::json object
Returns
T& Reference to self for fluent calling

◆ fill_from_json_impl()

forum_tag & dpp::forum_tag::fill_from_json_impl ( nlohmann::json *  j)
protected

Read struct values from a json object.

Parameters
jjson to read values from
Returns
A reference to self

◆ get_creation_time()

constexpr double dpp::managed::get_creation_time ( ) const
inlineconstexprnoexceptinherited

Get the creation time of this object according to Discord.

Returns
double creation time inferred from the snowflake ID. The minimum possible value is the first second of 2015.

◆ operator!=()

constexpr bool dpp::managed::operator!= ( const managed other) const
inlineconstexprnoexceptinherited

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are not the same id
false objects are the same id

◆ operator==()

constexpr bool dpp::managed::operator== ( const managed other) const
inlineconstexprnoexceptinherited

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are the same id
false objects are not the same id

◆ set_name()

forum_tag & dpp::forum_tag::set_name ( const std::string &  name)

Set name of this forum_tag object.

Parameters
nameName to set
Returns
Reference to self, so these method calls may be chained
Note
name will be truncated to 20 chars, if longer

◆ to_json()

auto dpp::json_interface< forum_tag >::to_json ( bool  with_id = false) const
inlineinherited

Convert object to nlohmann::json.

Parameters
with_idWhether to include the ID or not
Note
Some fields are conditionally filled, do not rely on all fields being present
Returns
json Json built from the structure

◆ to_json_impl()

json dpp::forum_tag::to_json_impl ( bool  with_id = false) const
protected

Build json for this forum_tag object.

Parameters
with_idinclude the ID in the json
Returns
json JSON object

Friends And Related Function Documentation

◆ json_interface< forum_tag >

friend struct json_interface< forum_tag >
friend

Member Data Documentation

◆ emoji

std::variant<std::monostate, snowflake, std::string> dpp::forum_tag::emoji

The emoji of the tag. Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji.

◆ id

snowflake dpp::managed::id = {}
inherited

Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.

◆ moderated

bool dpp::forum_tag::moderated

Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission.

◆ name

std::string dpp::forum_tag::name

The name of the tag (0-20 characters).

D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0