| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for dpp::forum_tag:
[legend]

## Public Member Functions

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

## Public Attributes

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.
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.
bool | moderated
| Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission.
std::string | name
| The name of the tag (0-20 characters).

## Protected Member Functions

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

## 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

  name | The 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 | ( |  | ) |

virtual default

Destructor

## Member Function Documentation

## ◆ build_json()

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

inline inherited

Convert object to json string.

Parameters

  with_id | Whether 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 | ) |

inline inherited

Convert object from nlohmann::json.

Parameters

  j | nlohmann::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

  j | json to read values from

Returns
  A reference to self

## ◆ get_creation_time()

double dpp::managed::get_creation_time | ( |  | ) | const

inline constexpr noexcept inherited

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!=()

bool dpp::managed::operator!= | ( | const managed & | other | ) | const

inline constexpr noexcept inherited

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other object to compare against

Returns
  true objects are not the same id
  false objects are the same id

## ◆ operator==()

bool dpp::managed::operator== | ( | const managed & | other | ) | const

inline constexpr noexcept inherited

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other 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

  name | Name 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

inline inherited

Convert object to nlohmann::json.

Parameters

  with_id | Whether 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_id | include the ID in the json

Returns
  json JSON object

## Friends And Related Symbol 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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0