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

Represents an automod rule. More...

#include "automod.h"

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...
 
std::string build_json (bool with_id=false) const
 Convert object to json string. More...
 
automod_rulefill_from_json (nlohmann::json *j)
 Convert object from nlohmann::json. 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...
 
auto to_json (bool with_id=false) const
 Convert object to nlohmann::json. More...
 

Public Attributes

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

dpp::automod_rule::~automod_rule ( )
virtualdefault

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

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

Build a json string for this object.

Returns
json JSON object

References exempt_roles, and dpp::unicode_emoji::v.

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)

Referenced by to_json_impl().

◆ 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.


The documentation for this class was generated from the following files: