D++ (DPP)
C++ Discord API Bot Library
dpp::automod_rule Class Reference

Represents an automod rule. More...

+ Inheritance diagram for dpp::automod_rule:
+ Collaboration diagram for dpp::automod_rule:

Public Member Functions

 automod_rule ()
 Construct a new automod rule object. More...
 
virtual ~automod_rule ()
 Destroy the automod rule 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...
 
automod_rulefill_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

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

Protected Member Functions

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

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

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

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

Fill object properties from JSON.

Parameters
jJSON to fill from
Returns
automod_rule& 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

◆ to_json()

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

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

Build a json string for this object.

Returns
json JSON object

Friends And Related Function 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.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