37    template<> 
struct core<discord_core_api::edit_channel_permission_overwrites_data> {
 
   38        using value_type                 = discord_core_api::edit_channel_permission_overwrites_data;
 
   39        static constexpr auto parseValue = createValue(
"allow", &value_type::allow, 
"deny", &value_type::deny, 
"channel_id", &value_type::channelId,
 
   40            "type", &value_type::type, 
"id", &value_type::roleOrUserId);
 
   43    template<> 
struct core<discord_core_api::modify_guild_channel_positions_data> {
 
   44        using value_type                 = discord_core_api::modify_guild_channel_positions_data;
 
   45        static constexpr auto parseValue = createValue(
"reason", &value_type::reason, 
"guild_id", &value_type::guildId, 
"modify_channel_data", &value_type::modifyChannelData);
 
   48    template<> 
struct core<discord_core_api::create_channel_invite_data> {
 
   49        using value_type                 = discord_core_api::create_channel_invite_data;
 
   50        static constexpr auto parseValue = createValue(
"channel_id", &value_type::channelId, 
"max_uses", &value_type::maxUses, 
"max_age", &value_type::maxAge, 
"temporary",
 
   51            &value_type::temporary, 
"unique", &value_type::unique, 
"target_type", &value_type::targetType, 
"target_user_id", &value_type::targetUserId, 
"target_application_id",
 
   52            &value_type::targetApplicationId);
 
   55    template<> 
struct core<discord_core_api::create_guild_channel_data> {
 
   56        using value_type                 = discord_core_api::create_guild_channel_data;
 
   57        static constexpr auto parseValue = createValue(
"name", &value_type::name, 
"type", &value_type::type, 
"position", &value_type::position, 
"parent_id", &value_type::parentId,
 
   58            "permission_overwrites", &value_type::permissionOverwrites, 
"nsfw", &value_type::nsfw, 
"rate_limit_per_user", &value_type::rateLimitPerUser, 
"topic",
 
   59            &value_type::topic, 
"user_limit", &value_type::userLimit, 
"bitrate", &value_type::bitrate, 
"default_auto_archive_duration", &value_type::defaultAutoArchiveDuration,
 
   60            "guild_id", &value_type::guildId);
 
   63    template<> 
struct core<discord_core_api::modify_guild_channel_position_data> {
 
   64        using value_type = discord_core_api::modify_guild_channel_position_data;
 
   65        static constexpr auto parseValue =
 
   66            createValue(
"id", &value_type::id, 
"position", &value_type::position, 
"parent_id", &value_type::parentId, 
"lock_permissions", &value_type::lockPermissions);
 
   69    template<> 
struct core<discord_core_api::modify_channel_data> {
 
   70        using value_type                 = discord_core_api::modify_channel_data;
 
   71        static constexpr auto parseValue = createValue(
"channel_id", &value_type::channelId, 
"channel_data", &value_type::channelData);
 
   74    template<> 
struct core<discord_core_api::create_dmchannel_data> {
 
   75        using value_type                 = discord_core_api::create_dmchannel_data;
 
   76        static constexpr auto parseValue = createValue(
"user_id", &value_type::userId);
 
   79    template<> 
struct core<discord_core_api::follow_news_channel_data> {
 
   80        using value_type                 = discord_core_api::follow_news_channel_data;
 
   81        static constexpr auto parseValue = createValue(
"channel_id", &value_type::channelId, 
"target_channel_id", &value_type::targetChannelId);
 
   84    template<> 
struct core<discord_core_api::update_channel_data> {
 
   85        using value_type                 = discord_core_api::update_channel_data;
 
   86        static constexpr auto parseValue = createValue(
"permission_overwrites", &value_type::permissionOverwrites, 
"default_auto_archive_duration",
 
   87            &value_type::defaultAutoArchiveDuration, 
"video_quality_mode", &value_type::videoQualityMode, 
"rate_limit_per_user", &value_type::rateLimitPerUser, 
"bitrate",
 
   88            &value_type::bitrate, 
"parent_id", &value_type::parentId, 
"rtc_region", &value_type::rtcRgion, 
"user_limit", &value_type::userLimit, 
"topic", &value_type::topic,
 
   89            "position", &value_type::position, 
"type", &value_type::type, 
"name", &value_type::name, 
"nsfw", &value_type::nsfw);
 
   95    channel_data::channel_data(
snowflake newId) {
 
  100        if (other.permissionOverwrites.size() > 0) {
 
  103        if (
static_cast<int64_t
>(other.flags) != 0) {
 
  106        setFlagValue(channel_flags::managed, other.managed);
 
  107        setFlagValue(channel_flags::nsfw, other.nsfw);
 
  108        if (other.memberCount != 0) {
 
  111        if (other.parentId != 0) {
 
  114        if (other.position != 0) {
 
  117        if (other.guildId != 0) {
 
  120        if (other.ownerId != 0) {
 
  123        if (other.topic != 
"") {
 
  126        if (other.name != 
"") {
 
  136    channel_cache_data::channel_cache_data(
const channel_data& other) {
 
  141        if (other.permissionOverwrites.size() > 0) {
 
  142            permissionOverwrites = std::move(other.permissionOverwrites);
 
  144        if (
static_cast<int64_t
>(other.flags) != 0) {
 
  147        setFlagValue(channel_flags::managed, other.managed);
 
  148        setFlagValue(channel_flags::nsfw, other.nsfw);
 
  149        if (other.memberCount != 0) {
 
  150            memberCount = other.memberCount;
 
  152        if (other.topic != 
"") {
 
  153            topic = std::move(other.topic);
 
  155        if (other.name != 
"") {
 
  156            name = std::move(other.name);
 
  158        if (other.parentId != 0) {
 
  159            parentId = other.parentId;
 
  161        if (other.position != 0) {
 
  162            position = other.position;
 
  164        if (other.guildId != 0) {
 
  165            guildId = other.guildId;
 
  167        if (other.ownerId != 0) {
 
  168            ownerId = other.ownerId;
 
  179        returnData.
managed               = getFlagValue(channel_flags::managed);
 
  180        returnData.permissionOverwrites = permissionOverwrites;
 
  181        returnData.nsfw                 = getFlagValue(channel_flags::nsfw);
 
  182        returnData.topic                = topic;
 
  183        returnData.name                 = name;
 
  184        returnData.memberCount          = memberCount;
 
  185        returnData.parentId             = parentId;
 
  186        returnData.position             = position;
 
  187        returnData.guildId              = guildId;
 
  188        returnData.ownerId              = ownerId;
 
  189        returnData.flags                = flags;
 
  190        returnData.type                 = type;
 
 
  195    channel_cache_data::channel_cache_data(
channel_data&& other) 
noexcept {
 
  196        *
this = std::move(other);
 
  199    jsonifier::string channel_data::getIconUrl() {
 
  200        jsonifier::string stringNew{ 
"https://cdn.discordapp.com/" };
 
  201        stringNew += 
"splashes/" + 
id.operator jsonifier::string() + 
"/" + 
icon + 
".png";
 
  205    modify_channel_data::modify_channel_data(
channel_data newData) {
 
  206        channelData.parentId          = newData.parentId.operator jsonifier::string();
 
  207        channelData.nsfw              = newData.getFlagValue(channel_flags::nsfw);
 
  208        channelData.permissionOverwrites = newData.permissionOverwrites;
 
  209        channelData.rateLimitPerUser  = newData.rateLimitPerUser;
 
  219        channels::doWeCacheChannelsBool = configManagerNew->doWeCacheChannels();
 
  220        channels::httpsClient           = client;
 
  224        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Channel };
 
  226        workload.workloadClass = discord_core_internal::https_workload_class::Get;
 
  227        workload.relativePath  = 
"/channels/" + dataPackage.
channelId;
 
  228        workload.callStack     = 
"channels::getChannelAsync()";
 
  229        channel_data data{ dataPackage.
channelId };
 
  230        if (cache.contains(data.id)) {
 
  231            data = cache[data.id];
 
  233        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
 
  234        if (doWeCacheChannelsBool) {
 
  235            insertChannel(
static_cast<channel_cache_data
>(data));
 
 
  241        if (channels::cache.contains(dataPackage.
channelId)) {
 
 
  249        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Channel };
 
  251        workload.workloadClass = discord_core_internal::https_workload_class::Patch;
 
  252        workload.relativePath  = 
"/channels/" + dataPackage.
channelId;
 
  253        parser.serializeJson(dataPackage, workload.content);
 
  254        workload.callStack = 
"channels::modifyChannelAsync()";
 
  255        if (dataPackage.
reason != 
"") {
 
  256            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  258        channel_data data{ dataPackage.
channelId };
 
  259        if (cache.contains(data.id)) {
 
  260            data = cache[data.id];
 
  262        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
 
  263        if (doWeCacheChannelsBool) {
 
  264            insertChannel(
static_cast<channel_cache_data
>(data));
 
 
  270        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Channel };
 
  272        workload.workloadClass = discord_core_internal::https_workload_class::Delete;
 
  273        workload.relativePath  = 
"/channels/" + dataPackage.
channelId;
 
  274        workload.callStack     = 
"channels::deleteOrCloseAChannelAsync()";
 
  275        if (dataPackage.
reason != 
"") {
 
  276            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  278        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
 
 
  283        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Channel_Permission_Overwrites };
 
  285        workload.workloadClass = discord_core_internal::https_workload_class::Put;
 
  286        workload.relativePath  = 
"/channels/" + dataPackage.
channelId + 
"/permissions/" + dataPackage.
roleOrUserId;
 
  287        parser.serializeJson(dataPackage, workload.content);
 
  288        workload.callStack = 
"channels::editChannelPermissionOverwritesAsync()";
 
  289        if (dataPackage.
reason != 
"") {
 
  290            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  292        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
 
 
  297        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Channel_Invites };
 
  299        workload.workloadClass = discord_core_internal::https_workload_class::Get;
 
  300        workload.relativePath  = 
"/channels/" + dataPackage.channelId + 
"/invites";
 
  301        workload.callStack     = 
"channels::getChannelInvitesAsync()";
 
  302        jsonifier::vector<invite_data> returnData{};
 
  303        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  304        co_return returnData;
 
 
  308        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Channel_Invite };
 
  310        workload.workloadClass = discord_core_internal::https_workload_class::Post;
 
  311        workload.relativePath  = 
"/channels/" + dataPackage.
channelId + 
"/invites";
 
  312        parser.serializeJson(dataPackage, workload.content);
 
  313        workload.callStack = 
"channels::createChannelInviteAsync()";
 
  314        if (dataPackage.
reason != 
"") {
 
  315            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  317        invite_data returnData{};
 
  318        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  319        co_return returnData;
 
 
  323        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Channel_Permission_Overwrites };
 
  325        workload.workloadClass = discord_core_internal::https_workload_class::Delete;
 
  326        workload.relativePath  = 
"/channels/" + dataPackage.
channelId + 
"/permissions/" + dataPackage.
roleOrUserId;
 
  327        workload.callStack     = 
"channels::deleteChannelPermissionOverwritesAsync()";
 
  328        if (dataPackage.
reason != 
"") {
 
  329            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  331        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
 
 
  336        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Follow_News_Channel };
 
  338        workload.workloadClass = discord_core_internal::https_workload_class::Post;
 
  339        workload.relativePath  = 
"/channels/" + dataPackage.channelId + 
"/followers";
 
  340        parser.serializeJson(dataPackage, workload.content);
 
  341        workload.callStack = 
"channels::followNewsChannelAsync()";
 
  342        channel_data returnData{};
 
  343        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  344        co_return returnData;
 
 
  348        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Trigger_Typing_Indicator };
 
  350        workload.workloadClass = discord_core_internal::https_workload_class::Post;
 
  351        workload.relativePath  = 
"/channels/" + dataPackage.channelId + 
"/typing";
 
  352        workload.callStack     = 
"channels::triggerTypingIndicatorAsync()";
 
  353        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
 
 
  358        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Channels };
 
  360        workload.workloadClass = discord_core_internal::https_workload_class::Get;
 
  361        workload.relativePath  = 
"/guilds/" + dataPackage.
guildId + 
"/channels";
 
  362        workload.callStack     = 
"channels::getGuildChannelsAsync()";
 
  363        jsonifier::vector<channel_data> returnData{};
 
  364        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  365        co_return returnData;
 
 
  369        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild_Channel };
 
  371        workload.workloadClass = discord_core_internal::https_workload_class::Post;
 
  372        workload.relativePath  = 
"/guilds/" + dataPackage.
guildId + 
"/channels";
 
  373        parser.serializeJson(dataPackage, workload.content);
 
  374        workload.callStack = 
"channels::createGuildChannelAsync()";
 
  375        if (dataPackage.
reason != 
"") {
 
  376            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  378        channel_data returnData{};
 
  379        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  380        co_return returnData;
 
 
  384        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild_Channel_Positions };
 
  386        workload.workloadClass = discord_core_internal::https_workload_class::Patch;
 
  387        workload.relativePath  = 
"/guilds/" + dataPackage.
guildId + 
"/channels";
 
  388        parser.serializeJson(dataPackage, workload.content);
 
  389        workload.callStack = 
"channels::modifyGuildChannelPositionsAsync()";
 
  390        if (dataPackage.
reason != 
"") {
 
  391            workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
 
  393        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
 
 
  398        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Create_User_Dm };
 
  400        workload.workloadClass = discord_core_internal::https_workload_class::Post;
 
  401        workload.relativePath  = 
"/users/@me/channels";
 
  402        workload.callStack     = 
"channels::createDMChannelAsync()";
 
  403        parser.serializeJson(dataPackage, workload.content);
 
  404        channel_data returnData{};
 
  405        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  406        co_return returnData;
 
 
  410        discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Voice_Regions };
 
  412        workload.workloadClass = discord_core_internal::https_workload_class::Get;
 
  413        workload.relativePath  = 
"/voice/regions";
 
  414        workload.callStack     = 
"channels::getVoiceRegionsAsync()";
 
  415        jsonifier::vector<voice_region_data> returnData{};
 
  416        channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
 
  417        co_return returnData;
 
 
  421        channels::cache.erase(channelId);
 
  424    bool channels::doWeCacheChannels() {
 
  425        return channels::doWeCacheChannelsBool;
 
  430    bool channels::doWeCacheChannelsBool{};
 
Data structure representing a single channel_data.
 
uint32_t position
The position of the channel_data, in the guild's channel_data list.
 
jsonifier::string topic
channel_data topic.
 
snowflake ownerId
snowflake of the channel_data's owner.
 
channel_type type
The type of the channel_data.
 
jsonifier::string name
Name of the channel_data.
 
uint32_t memberCount
count of members active in the channel_data.
 
snowflake guildId
snowflake of the channel_data's guild, if applicable.
 
channel_flags flags
Flags combined as a bitmask.
 
jsonifier::vector< over_write_data > permissionOverwrites
Permission overwrites.
 
snowflake parentId
snowflake of the channel_data's parent channel_data/category.
 
jsonifier::string icon
Icon hash of the group dm.
 
bool managed
For group dm channels: whether the channel is managed by an application via the gdm....
 
static co_routine< channel_data > createDMChannelAsync(create_dmchannel_data dataPackage)
Collect a direct-message_data channel between the bot and the user_data.
 
static co_routine< jsonifier::vector< voice_region_data > > getVoiceRegionsAsync()
Collect a list of voice regions that are usable for the rtc-region option of a given channel.
 
static channel_cache_data getCachedChannel(get_channel_data dataPackage)
Collects a channel from the library's cache.
 
static co_routine< void > deleteOrCloseChannelAsync(delete_or_close_channel_data dataPackage)
Delete a channel, or close a protected message.
 
static co_routine< invite_data > createChannelInviteAsync(create_channel_invite_data dataPackage)
Creates an invite to a selected channel_data.
 
static co_routine< void > triggerTypingIndicatorAsync(trigger_typing_indicator_data dataPackage)
Triggers the typing indicator for the bot in the given channel.
 
static co_routine< void > deleteChannelPermissionOverwritesAsync(delete_channel_permission_overwrites_data dataPackage)
Delete the given jsonifier::string overwrites for a given user or role_data.
 
static co_routine< void > modifyGuildChannelPositionsAsync(modify_guild_channel_positions_data dataPackage)
Re-orders the channel_data positions, within a chosen guild_data.
 
static co_routine< channel_data > createGuildChannelAsync(create_guild_channel_data dataPackage)
Creates a new channel_data within a chosen guild_data.
 
static co_routine< jsonifier::vector< invite_data > > getChannelInvitesAsync(get_channel_invites_data dataPackage)
Collects a vector of the invites to a given channel.
 
static co_routine< channel_data > followNewsChannelAsync(follow_news_channel_data dataPackage)
Follows a given new channel_data with another channel_data.
 
static co_routine< void > editChannelPermissionOverwritesAsync(edit_channel_permission_overwrites_data dataPackage)
Edit the given jsonifier::string overwrites for a given user or role_data.
 
static co_routine< channel_data > getChannelAsync(get_channel_data dataPackage)
Collects a channel from the discord servers.
 
static co_routine< jsonifier::vector< channel_data > > getGuildChannelsAsync(get_guild_channels_data dataPackage)
Collects a list of channels from a chosen guild_data.
 
static co_routine< channel_data > modifyChannelAsync(modify_channel_data dataPackage)
Modifies a channel's properties.
 
A co_routine - representing a potentially asynchronous operation/function.
 
For sending Https requests.
 
A template class representing an object cache.
 
A class representing a snowflake identifier with various operations.
 
DCA_INLINE auto newThreadAwaitable()
An awaitable that can be used to launch the co_routine onto a new thread - as well as return the hand...
 
The main namespace for the forward-facing interfaces.
 
For creating an invite to a given channel.
 
snowflake channelId
The id of the channel_data to create the invite for.
 
jsonifier::string reason
Reason for creating the invite.
 
For collecting a direct-messaging channel_data.
 
For creating a new channel_data within a chosen guild_data.
 
jsonifier::string reason
Reason for creating the channel_data.
 
snowflake guildId
The guild_data within which to create the channel_data.
 
For deleting the permission_types overwrites of a given channel for a given role or user_data.
 
jsonifier::string reason
Reason for deleting these permission overwrites.
 
snowflake roleOrUserId
The role_data or user_data id for whom to delete the permission_types overwrites.
 
snowflake channelId
The id of the channel_data to modify permissions for.
 
For deleting or closing a channel.
 
snowflake channelId
The id of the channel_data to close/delete.
 
jsonifier::string reason
The reason for deleting/closing the channel_data.
 
For editing the permission_types overwrites of a given channel, for a given role or user_data.
 
snowflake roleOrUserId
The role_data or user_data snowflake to modify the permissions for.
 
jsonifier::string reason
Reason for editing the permission overwrites.
 
snowflake channelId
The channel_data id of the desired channel_data to modify the permissions for.
 
For following a news channel_data.
 
For collecting a channel from discord's servers.
 
snowflake channelId
The id of the channel_data to acquire.
 
For collecting the invites to a given channel.
 
For acquiring a list of channels from a chosen guild_data.
 
snowflake guildId
The guild_data from which to collect the channels from.
 
For modifying a channel's properties.
 
update_channel_data channelData
The responseData of the channel_data to be updated.
 
snowflake channelId
The id of the channel_data to modify.
 
jsonifier::string reason
A reason for modifying the channel_data.
 
For modifying the current positions of one or more channels in the guild_data.
 
jsonifier::string reason
Reason for re-ordering the channel_data positions.
 
snowflake guildId
Guild within which to re-order the channel_data positions.
 
For triggering the typing indicator in a given channel.