DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
AutoModerationEntities.hpp
Go to the documentation of this file.
1/*
2 MIT License
3
4 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
5
6 Copyright 2022, 2023 Chris M. (RealTimeChris)
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in all
16 copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25*/
26/// AutoModerationEntities.hpp - Header for the auto-moderation related classes and structs.
27/// Jun 17, 2022 Chris M.
28/// https://discordcoreapi.com
29/// \file AutoModerationEntities.hpp
30#pragma once
31
35
36namespace discord_core_api {
37
38 /**
39 * \addtogroup foundation_entities
40 * @{
41 */
42
43 /// @brief For listing all of the auto-moderation-rules for a particular guild .
45 snowflake guildId{};///< The id of the guild for which you would like to list the auto-moderation rules.
46 };
47
48 /// @brief For collecting an auto-moderation-rule for a particular auto_moderation_rule_data.
50 snowflake autoModerationRuleId{};///< The id of the auto-moderation-rule you would like to collect.
51 snowflake guildId{};///< The id of the guild from which you would like to collect the auto-moderation-rule from.
52 };
53
54 /// @brief For creating an auto-moderation-rule.
56 jsonifier::vector<snowflake> exemptChannels{};///< The channel ids that should not be affected by the rule(maximum of 50).
57 jsonifier::vector<snowflake> exemptRoles{};///< The role ids that should not be affected by the rule(maximum of 20).
58 trigger_meta_data triggerMetadata{};///< The trigger metadata.
59 jsonifier::vector<action_data> actions{};///< The actions which will execute when the rule is triggered
60 trigger_type triggerType{};///< The trigger type.
61 event_type eventType{};///< The event type.
62 snowflake guildId{};///< The guild within which to create the auto_moderation_rule_data.
63 jsonifier::string name{};///< The rule name.
64 bool enabled{};///< Whether the rule is enabled(false by default).
65 };
66
67 /// @brief For modifying an auto-moderation-rule.
69 jsonifier::vector<snowflake> exemptChannels{};///< The channel ids that should not be affected by the rule(maximum of 50).
70 jsonifier::vector<snowflake> exemptRoles{};///< The role ids that should not be affected by the rule(maximum of 20).
71 trigger_meta_data triggerMetadata{};///< The trigger metadata.
72 jsonifier::vector<action_data> actions{};///< The actions which will execute when the rule is triggered
73 snowflake autoModerationRuleId{};///< The id of the auto-moderation-rule you would like to modify.
74 event_type eventType{};///< The event type.
75 snowflake guildId{};///< The auto_moderation_rule_data within which to modify the auto-moderation-rule.
76 jsonifier::string name{};///< The rule name.
77 bool enabled{};///< Whether the rule is enabled(false by default).
78 };
79
80 /// @brief For when an auto-moderation-rule is executed.
82 snowflake alertSystemMessageId{};///< The id of any system auto moderation messages posted as a result of this action.
83 trigger_type ruleTriggerType{};///< The trigger type of rule which was triggered.
84 jsonifier::string matchedKeyword{};///< The word or phrase configured in the rule that triggered the rule
85 jsonifier::string matchedContent{};///< The substring in content that triggered the rule.
86 jsonifier::string content{};///< The user generated text content.
87 snowflake channelId{};///< The id of the channel in which user content was posted.
88 snowflake messageId{};///< The id of any user message which content belongs to.
89 action_data action{};///< The action which was executed.
90 snowflake guildId{};///< The id of the guild in which action was executed.
91 snowflake ruleId{};///< The id of the rule which action belongs to.
92 snowflake userId{};///< The id of the user which generated the content which triggered the rule.
93
95 };
96
97 /// @brief For deleting an auto-moderation-rule.
99 snowflake autoModerationRuleId{};///< The id of the auto-moderation-rule you would like to delete.
100 snowflake guildId{};///< Guild within which to delete the auto-moderation-rule.
101 };
102
103 /**@}*/
104
105 /**
106 * \addtogroup main_endpoints
107 * @{
108 */
109 /// @brief An interface class for the auto_moderation_rule_data related discord endpoints.
110 class DiscordCoreAPI_Dll auto_moderation_rules {
111 public:
112 static void initialize(discord_core_internal::https_client*);
113
114 /// @brief Get all of the guild's auto-moderation-rules.
115 /// @param dataPackage the moderation rule data to get.
116 /// @return a co_routine containing a vector<auto_moderation_rule_data>.
117 co_routine<jsonifier::vector<auto_moderation_rule_data>> listAutoModerationRulesForGuildAsync(const list_auto_moderation_rules_for_guild_data dataPackage);
118
119 /// @brief Get a particular auto-moderation-rule
120 /// @param dataPackage the moderation rule data to get.
121 /// @return a co_routine containing a auto_moderation_rule_data.
122 co_routine<auto_moderation_rule_data> getAutoModerationRuleAsync(const get_auto_moderation_rule_data dataPackage);
123
124 /// @brief Create a particular auto-moderation-rule
125 /// @param dataPackage the moderation rule data to create.
126 /// @return a co_routine containing a auto_moderation_rule_data.
127 co_routine<auto_moderation_rule_data> createAutoModerationRuleAsync(const create_auto_moderation_rule_data dataPackage);
128
129 /// @brief Modify a particular auto-moderation-rule
130 /// @param dataPackage the moderation rule data to apply.
131 /// @return a co_routine containing a auto_moderation_rule_data.
132 co_routine<auto_moderation_rule_data> modifyAutoModerationRuleAsync(const modify_auto_moderation_rule_data dataPackage);
133
134 /// @brief Delete a particular auto-moderation-rule
135 /// @param dataPackage the moderation rule data to delete.
136 /// @return a co_routine containing a void.
137 co_routine<void> deleteAutoModerationRuleAsync(const delete_auto_moderation_rule_data dataPackage);
138
139 protected:
140 static discord_core_internal::https_client* httpsClient;
141 };
142
143 /**@}*/
144
145}// namespace discord_core_internal
An interface class for the auto_moderation_rule_data related discord endpoints.
A co_routine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:83
A class representing a snowflake identifier with various operations.
Definition: Base.hpp:680
event_type
Event types for auto-moderation.
trigger_type
Trigger types for auto-moderation.
The main namespace for the forward-facing interfaces.
For representing a single auto-moderation-rule-action.
trigger_type ruleTriggerType
The trigger type of rule which was triggered.
snowflake alertSystemMessageId
The id of any system auto moderation messages posted as a result of this action.
jsonifier::string content
The user generated text content.
snowflake channelId
The id of the channel in which user content was posted.
snowflake guildId
The id of the guild in which action was executed.
snowflake userId
The id of the user which generated the content which triggered the rule.
jsonifier::string matchedKeyword
The word or phrase configured in the rule that triggered the rule.
snowflake ruleId
The id of the rule which action belongs to.
snowflake messageId
The id of any user message which content belongs to.
jsonifier::string matchedContent
The substring in content that triggered the rule.
jsonifier::vector< snowflake > exemptChannels
The channel ids that should not be affected by the rule(maximum of 50).
jsonifier::vector< snowflake > exemptRoles
The role ids that should not be affected by the rule(maximum of 20).
jsonifier::vector< action_data > actions
The actions which will execute when the rule is triggered.
snowflake guildId
The guild within which to create the auto_moderation_rule_data.
trigger_meta_data triggerMetadata
The trigger metadata.
bool enabled
Whether the rule is enabled(false by default).
snowflake guildId
Guild within which to delete the auto-moderation-rule.
snowflake autoModerationRuleId
The id of the auto-moderation-rule you would like to delete.
For collecting an auto-moderation-rule for a particular auto_moderation_rule_data.
snowflake autoModerationRuleId
The id of the auto-moderation-rule you would like to collect.
snowflake guildId
The id of the guild from which you would like to collect the auto-moderation-rule from.
For listing all of the auto-moderation-rules for a particular guild .
snowflake guildId
The id of the guild for which you would like to list the auto-moderation rules.
jsonifier::vector< snowflake > exemptChannels
The channel ids that should not be affected by the rule(maximum of 50).
jsonifier::vector< action_data > actions
The actions which will execute when the rule is triggered.
jsonifier::vector< snowflake > exemptRoles
The role ids that should not be affected by the rule(maximum of 20).
bool enabled
Whether the rule is enabled(false by default).
snowflake guildId
The auto_moderation_rule_data within which to modify the auto-moderation-rule.
snowflake autoModerationRuleId
The id of the auto-moderation-rule you would like to modify.
trigger_meta_data triggerMetadata
The trigger metadata.
Trigger metadata for auto-moderation-rules.