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

Search
Loading...
Searching...
No Matches
dpp::automod_rule Class Reference

Represents an automod rule. More...

`#include <automod.h>`

Inheritance diagram for dpp::automod_rule:
[legend]
Collaboration diagram for dpp::automod_rule:
[legend]

## Public Member Functions

| automod_rule ()
| Construct a new automod rule object.
virtual | ~automod_rule ()
| Destroy the automod rule object.
std::string | build_json (bool with_id=false) const
| Convert object to json string.
automod_rule & | 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.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.

## Public Attributes

std::vector< automod_action > | actions
| the actions which will execute when the rule is triggered
snowflake | creator_id
| The user which first created this rule.
bool | enabled
| Whether the rule is enabled.
automod_event_type | event_type
| The rule event type.
std::vector< snowflake > | exempt_channels
| the channel ids that should not be affected by the rule (Maximum of 50)
std::vector< snowflake > | exempt_roles
| the role ids that should not be affected by the rule (Maximum of 20)
snowflake | guild_id
| the guild which this rule belongs to
snowflake | id
| the id of this rule
std::string | name
| the rule name
automod_metadata | trigger_metadata
| The rule trigger metadata.
automod_trigger_type | trigger_type
| The rule trigger type.

## Protected Member Functions

automod_rule & | fill_from_json_impl (nlohmann::json *j)
| Fill object properties from JSON.
virtual json | to_json_impl (bool with_id=false) const
| Build a json string for this object.

## Friends

struct | json_interface< automod_rule >

## Detailed Description

Represents an automod rule.

## Constructor & Destructor Documentation

## ◆ automod_rule()

dpp::automod_rule::automod_rule | ( |  | ) |

Construct a new automod rule object.

## ◆ ~automod_rule()

virtual dpp::automod_rule::~automod_rule | ( |  | ) |

virtual

Destroy the automod rule object.

## Member Function Documentation

## ◆ build_json()

std::string dpp::json_interface< automod_rule >::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()

automod_rule & dpp::json_interface< automod_rule >::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()

automod_rule & dpp::automod_rule::fill_from_json_impl | ( | nlohmann::json * | j | ) |

protected

Fill object properties from JSON.

Parameters

  j | JSON to fill from

Returns
  automod_rule& 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

## ◆ to_json()

auto dpp::json_interface< automod_rule >::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()

virtual json dpp::automod_rule::to_json_impl | ( | bool | with_id = false | ) | const

protected virtual

Build a json string for this object.

Returns
  json JSON object

## Friends And Related Symbol Documentation

## ◆ json_interface< automod_rule >

friend struct json_interface< automod_rule >

friend

## Member Data Documentation

## ◆ actions

std::vector<automod_action> dpp::automod_rule::actions

the actions which will execute when the rule is triggered

## ◆ creator_id

snowflake dpp::automod_rule::creator_id

The user which first created this rule.

## ◆ enabled

bool dpp::automod_rule::enabled

Whether the rule is enabled.

## ◆ event_type

automod_event_type dpp::automod_rule::event_type

The rule event type.

## ◆ exempt_channels

std::vector<snowflake> dpp::automod_rule::exempt_channels

the channel ids that should not be affected by the rule (Maximum of 50)

## ◆ exempt_roles

std::vector<snowflake> dpp::automod_rule::exempt_roles

the role ids that should not be affected by the rule (Maximum of 20)

## ◆ guild_id

snowflake dpp::automod_rule::guild_id

the guild which this rule belongs to

## ◆ id

snowflake dpp::automod_rule::id

the id of this rule

## ◆ name

std::string dpp::automod_rule::name

the rule name

## ◆ trigger_metadata

automod_metadata dpp::automod_rule::trigger_metadata

The rule trigger metadata.

## ◆ trigger_type

automod_trigger_type dpp::automod_rule::trigger_type

The rule trigger type.

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