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

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

Represents a guild on Discord (AKA a server). More...

`#include <guild.h>`

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

## Public Member Functions

| guild ()
virtual | ~guild ()=default
| Destroy the guild object.
permission | base_permissions (const class user *user) const
| Compute the base permissions for a member on this guild, before channel overwrites are applied. This method takes into consideration the following cases:
permission | base_permissions (const guild_member &member) const
| Compute the base permissions for a member on this guild, before channel overwrites are applied. This method takes into consideration the following cases:
std::string | build_json (bool with_id=false) const
| Convert object to json string.
bool | connect_member_voice (const cluster &owner, snowflake user_id, bool self_mute=false, bool self_deaf=false, bool dave=true)
| Connect to a voice channel another guild member is in.
guild & | fill_from_json (class discord_client *shard, nlohmann::json *j)
guild & | fill_from_json (nlohmann::json *j)
| Convert object from nlohmann::json.
std::string | get_banner_url (uint16_t size=0, const image_type format=i_png, bool prefer_animated=true) const
| Get the banner url of the guild if it have one, otherwise returns an empty string.
constexpr double | get_creation_time () const noexcept
| Get the creation time of this object according to Discord.
std::string | get_discovery_splash_url (uint16_t size=0, const image_type format=i_png) const
| Get the discovery splash url of the guild if it have one, otherwise returns an empty string.
std::string | get_icon_url (uint16_t size=0, const image_type format=i_png, bool prefer_animated=true) const
| Get the icon url of the guild if it have one, otherwise returns an empty string.
std::string | get_splash_url (uint16_t size=0, const image_type format=i_png) const
| Get the splash url of the guild if it have one, otherwise returns an empty string.
bool | has_animated_banner () const
| Guild has access to set an animated guild banner image.
bool | has_animated_banner_hash () const
| Guild banner is actually an animated gif.
bool | has_animated_icon () const
| Guild has access to set an animated guild icon.
bool | has_animated_icon_hash () const
| Guild icon is actually an animated gif.
bool | has_auto_moderation () const
| Guild has auto moderation features.
bool | has_banner () const
| Guild has access to set a guild banner image.
bool | has_channel_banners () const
| guild has access to channel banners feature
bool | has_creator_store_page () const
| guild has enabled the role subscription promo page
bool | has_invite_splash () const
| Guild has access to set an invite splash background.
bool | has_invites_disabled () const
| True if has paused invites, preventing new users from joining.
bool | has_member_verification_gate () const
| Guild has enabled membership screening.
bool | has_monetization_enabled () const
| guild has access to monetization features
bool | has_more_stickers () const
| guild has increased custom sticker slots
bool | has_news () const
| Guild has access to create announcement channels.
bool | has_premium_progress_bar_enabled () const
| True if the premium progress bar is enabled.
bool | has_raid_alerts_disabled () const
| Guild has disabled alerts for join raids in the configured safety alerts channel.
bool | has_role_icons () const
| guild is able to set role icons
bool | has_role_subscriptions () const
| Has enabled role subscriptions.
bool | has_role_subscriptions_available_for_purchase () const
| Guild has role subscriptions that can be purchased.
bool | has_seven_day_thread_archive () const
| guild has access to the seven day archive time for threads
bool | has_support_server () const
| Guild has been set as a support server on the App Directory.
bool | has_three_day_thread_archive () const
| guild has access to the three day archive time for threads
bool | has_ticketed_events () const
| guild has enabled ticketed events
bool | has_vanity_url () const
| Guild has access to set a vanity URL.
bool | has_vip_regions () const
| Guild has access to set 384kbps bitrate in voice.
bool | is_community () const
| Has enabled community.
bool | is_discoverable () const
| Guild is discoverable.
bool | is_featureable () const
| Guild is featurable.
bool | is_large () const
| Is a large server (>250 users).
bool | is_partnered () const
| Guild is a discord partnered server.
bool | is_preview_enabled () const
| Guild has preview enabled.
bool | is_unavailable () const
| Is unavailable due to outage (most other fields will be blank or outdated.
bool | is_verified () const
| Guild is a verified server.
bool | is_welcome_screen_enabled () const
| Guild has enabled the welcome screen.
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.
permission | permission_overwrites (const guild_member &member, const channel &channel) const
| Get the overall permissions for a member in this channel, including channel overwrites, role permissions and admin privileges.
permission | permission_overwrites (const uint64_t base_permissions, const user *user, const channel *channel) const
| Get the overall permissions for a member in this channel, including channel overwrites, role permissions and admin privileges.
void | rehash_members ()
| Rehash members map.
guild & | remove_banner ()
| Remove the guild banner.
guild & | remove_discovery_splash ()
| Remove the guild discovery splash.
guild & | remove_icon ()
| Remove the guild icon.
guild & | remove_splash ()
| Remove the guild invite splash.
guild & | set_banner (image_type format, const std::byte *data, uint32_t size)
| Set the guild banner image. Server needs banner feature. Must be 16:9, and depending on nitro level, must be png or jpeg. Animated gif needs the animated banner server feature.
guild & | set_banner (image_type format, std::string_view data)
| Set the guild banner image. Server needs banner feature. Must be 16:9, and depending on nitro level, must be png or jpeg. Animated gif needs the animated banner server feature.
guild & | set_discovery_splash (image_type format, const std::byte *data, uint32_t size)
| Set the guild discovery splash image. Server needs discoverable feature. Must be 16:9 and png or jpeg.
guild & | set_discovery_splash (image_type format, std::string_view data)
| Set the guild discovery splash image. Server needs discoverable feature. Must be 16:9 and png or jpeg.
guild & | set_icon (image_type format, const std::byte *data, uint32_t size)
| Set the 1024x1024 guild icon image. Must be png or jpeg. Gif allowed only if the server has animated icon.
guild & | set_icon (image_type format, std::string_view data)
| Set the guild icon image. Must be 1024x1024 and png or jpeg. Gif allowed only if the server has animated icon.
guild & | set_name (const std::string &n)
| Set the name of the guild in the object Min length: 2, Max length: 100 (not including leading/trailing spaces).
guild & | set_splash (image_type format, const std::byte *data, uint32_t size)
| Set the guild invite splash image. Server needs invite splash feature. Must be 16:9 and png or jpeg.
guild & | set_splash (image_type format, std::string_view data)
| Set the guild invite splash image. Server needs invite splash feature. Must be 16:9 and png or jpeg.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.
bool | widget_enabled () const
| Widget is enabled for this server.

## Public Attributes

snowflake | afk_channel_id
| Snowflake ID of AFK voice channel or 0.
guild_afk_timeout_t | afk_timeout
| Voice AFK timeout before moving users to AFK channel.
snowflake | application_id
| ID of creating application, if any, or 0.
utility::icon | banner
| Server banner.
std::vector< snowflake > | channels
| List of channels on this server.
default_message_notification_t | default_message_notifications
| Setting for how notifications are to be delivered to users.
std::string | description
| Server description.
utility::icon | discovery_splash
| Guild discovery splash.
std::vector< snowflake > | emojis
| List of emojis.
guild_explicit_content_t | explicit_content_filter
| Whether or not explicit content filtering is enable and what setting it is.
uint32_t | flags
| Flags bitmask as defined by values within dpp::guild_flags.
uint16_t | flags_extra
| Additional flags (values from dpp::guild_flags_extra).
utility::icon | icon
| Guild icon.
snowflake | id = {}
| Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.
uint32_t | max_members
| the maximum number of members for the guild
uint32_t | max_presences
| the maximum number of presences for the guild.
uint8_t | max_video_channel_users
| Maximum users in a video channel, or 0.
uint32_t | member_count
| Approximate member count. May be sent as zero.
members_container | members
| List of guild members.
mfa_level_t | mfa_level
| If multi factor authentication is required for moderators or not.
std::string | name
| Guild name.
guild_nsfw_level_t | nsfw_level
| Guild NSFW level.
snowflake | owner_id
| Snowflake id of guild owner.
uint16_t | premium_subscription_count
| Number of boosters.
guild_premium_tier_t | premium_tier
| Boost level.
snowflake | public_updates_channel_id
| Public updates channel id or 0.
std::vector< snowflake > | roles
| Roles defined on this server.
snowflake | rules_channel_id
| ID of rules channel for communities.
snowflake | safety_alerts_channel_id
| The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord.
uint16_t | shard_id
| Shard ID of the guild.
utility::icon | splash
| Guild splash.
snowflake | system_channel_id
| ID of system channel where discord update messages are sent.
std::vector< snowflake > | threads
| List of threads on this server.
std::string | vanity_url_code
| Vanity url code for verified or partnered servers and boost level 3.
verification_level_t | verification_level
| Verification level of server.
std::map< snowflake, voicestate > | voice_members
| List of members in voice channels in the guild.
dpp::welcome_screen | welcome_screen
| Welcome screen.
snowflake | widget_channel_id
| Snowflake ID of widget channel, or 0.

## Protected Member Functions

guild & | fill_from_json_impl (nlohmann::json *j)
json | to_json_impl (bool with_id=false) const

## Friends

struct | json_interface< guild >

## Detailed Description

Represents a guild on Discord (AKA a server).

## Constructor & Destructor Documentation

## ◆ guild()

dpp::guild::guild | ( |  | ) |

Default constructor, zeroes all values

## ◆ ~guild()

virtual dpp::guild::~guild | ( |  | ) |

virtual default

Destroy the guild object.

## Member Function Documentation

## ◆ base_permissions() [1/2]

permission dpp::guild::base_permissions | ( | const class user * | user | ) | const

Compute the base permissions for a member on this guild, before channel overwrites are applied. This method takes into consideration the following cases:

- Guild owner
- Guild roles including @everyone

Parameters

  user | User to get permissions for

Returns
  permission permissions bitmask. If the member has administrator privileges, the bitmask returns with all flags set

Note
  Requires role cache to be enabled (it's enabled by default).

Warning
  The method will search for the guild member in the cache by the users id. If the guild member is not in cache, the method will always return 0.

## ◆ base_permissions() [2/2]

permission dpp::guild::base_permissions | ( | const guild_member & | member | ) | const

Compute the base permissions for a member on this guild, before channel overwrites are applied. This method takes into consideration the following cases:

- Guild owner
- Guild roles including @everyone

Parameters

  member | member to get permissions for

Returns
  permission permissions bitmask. If the member has administrator privileges, the bitmask returns with all flags set

Note
  Requires role cache to be enabled (it's enabled by default).

## ◆ build_json()

std::string dpp::json_interface< guild >::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

## ◆ connect_member_voice()

bool dpp::guild::connect_member_voice | ( | const cluster & | owner,
|  | snowflake | user_id,
|  | bool | self_mute = false,
|  | bool | self_deaf = false,
|  | bool | dave = true )

Connect to a voice channel another guild member is in.

Parameters

  owner | Cluster the user's shard is on
  user_id | User id to join
  self_mute | True if the bot should mute itself
  self_deaf | True if the bot should deafen itself
  dave | True to enable DAVE E2EE

Returns
  True if the user specified is in a vc, false if they aren't

Note
  This is NOT a synchronous blocking call! The bot isn't instantly ready to send or listen for audio, as we have to wait for the connection to the voice server to be established! e.g. wait for dpp::cluster::on_voice_ready event, and then send the audio within that event.

## ◆ fill_from_json() [1/2]

guild & dpp::guild::fill_from_json | ( | class discord_client * | shard,
|  | nlohmann::json * | j )

Read class values from json object

Parameters

  shard | originating shard
  j | A json object to read from

Returns
  A reference to self

## ◆ fill_from_json() [2/2]

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

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

protected

Read class values from json object

Parameters

  j | A json object to read from

Returns
  A reference to self

## ◆ get_banner_url()

std::string dpp::guild::get_banner_url | ( | uint16_t | size = 0,
|  | const image_type | format = i_png,
|  | bool | prefer_animated = true ) const

Get the banner url of the guild if it have one, otherwise returns an empty string.

Parameters

  size | The size of the banner in pixels. It can be any power of two between 16 and 4096, otherwise the default sized banner is returned.
  format | The format to use for the avatar. It can be one of i_webp, i_jpg, i_png or i_gif. Passing i_gif might result in an invalid url for non-animated images. Consider using the prefer_animated parameter instead.
  prefer_animated | Whether you prefer gif format. If true, it'll return gif format whenever the image is available as animated.

Returns
  std::string banner url or an empty string, if required attributes are missing or an invalid format was passed

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

## ◆ get_discovery_splash_url()

std::string dpp::guild::get_discovery_splash_url | ( | uint16_t | size = 0,
|  | const image_type | format = i_png ) const

Get the discovery splash url of the guild if it have one, otherwise returns an empty string.

Parameters

  size | The size of the discovery splash in pixels. It can be any power of two between 16 and 4096, otherwise the default sized discovery splash is returned.
  format | The format to use for the avatar. It can be one of i_webp, i_jpg or i_png.

Returns
  std::string discovery splash url or an empty string, if required attributes are missing or an invalid format was passed

## ◆ get_icon_url()

std::string dpp::guild::get_icon_url | ( | uint16_t | size = 0,
|  | const image_type | format = i_png,
|  | bool | prefer_animated = true ) const

Get the icon url of the guild if it have one, otherwise returns an empty string.

Parameters

  size | The size of the icon in pixels. It can be any power of two between 16 and 4096, otherwise the default sized icon is returned.
  format | The format to use for the avatar. It can be one of i_webp, i_jpg, i_png or i_gif. When passing i_gif, it returns an empty string for non-animated images. Consider using the prefer_animated parameter instead.
  prefer_animated | Whether you prefer gif format. If true, it'll return gif format whenever the image is available as animated.

Returns
  std::string icon url or an empty string, if required attributes are missing or an invalid format was passed

## ◆ get_splash_url()

std::string dpp::guild::get_splash_url | ( | uint16_t | size = 0,
|  | const image_type | format = i_png ) const

Get the splash url of the guild if it have one, otherwise returns an empty string.

Parameters

  size | The size of the splash in pixels. It can be any power of two between 16 and 4096, otherwise the default sized splash is returned.
  format | The format to use for the avatar. It can be one of i_webp, i_jpg or i_png.

Returns
  std::string splash url or an empty string, if required attributes are missing or an invalid format was passed

## ◆ has_animated_banner()

bool dpp::guild::has_animated_banner | ( |  | ) | const

Guild has access to set an animated guild banner image.

Returns
  bool can have animated banner image

## ◆ has_animated_banner_hash()

bool dpp::guild::has_animated_banner_hash | ( |  | ) | const

Guild banner is actually an animated gif.

Returns
  bool is animated gif

## ◆ has_animated_icon()

bool dpp::guild::has_animated_icon | ( |  | ) | const

Guild has access to set an animated guild icon.

Returns
  bool can have animated icon

## ◆ has_animated_icon_hash()

bool dpp::guild::has_animated_icon_hash | ( |  | ) | const

Guild icon is actually an animated gif.

Returns
  bool is animated gif

## ◆ has_auto_moderation()

bool dpp::guild::has_auto_moderation | ( |  | ) | const

Guild has auto moderation features.

Returns
  bool has auto moderation features

## ◆ has_banner()

bool dpp::guild::has_banner | ( |  | ) | const

Guild has access to set a guild banner image.

Returns
  bool can have banner image

## ◆ has_channel_banners()

bool dpp::guild::has_channel_banners | ( |  | ) | const

guild has access to channel banners feature

Returns
  bool has channel banners

Deprecated
  Removed by Discord

## ◆ has_creator_store_page()

bool dpp::guild::has_creator_store_page | ( |  | ) | const

guild has enabled the role subscription promo page

Returns
  bool has role subscription promo page enabled

## ◆ has_invite_splash()

bool dpp::guild::has_invite_splash | ( |  | ) | const

Guild has access to set an invite splash background.

Returns
  bool can have an invite splash

## ◆ has_invites_disabled()

bool dpp::guild::has_invites_disabled | ( |  | ) | const

True if has paused invites, preventing new users from joining.

Returns
  bool has paused invites

## ◆ has_member_verification_gate()

bool dpp::guild::has_member_verification_gate | ( |  | ) | const

Guild has enabled membership screening.

Returns
  bool has membership screening

## ◆ has_monetization_enabled()

bool dpp::guild::has_monetization_enabled | ( |  | ) | const

guild has access to monetization features

Returns
  bool

## ◆ has_more_stickers()

bool dpp::guild::has_more_stickers | ( |  | ) | const

guild has increased custom sticker slots

Returns
  bool has more stickers

## ◆ has_news()

bool dpp::guild::has_news | ( |  | ) | const

Guild has access to create announcement channels.

Returns
  bool has announcement channels features enabled

## ◆ has_premium_progress_bar_enabled()

bool dpp::guild::has_premium_progress_bar_enabled | ( |  | ) | const

True if the premium progress bar is enabled.

Returns
  bool has progress bar enabled

## ◆ has_raid_alerts_disabled()

bool dpp::guild::has_raid_alerts_disabled | ( |  | ) | const

Guild has disabled alerts for join raids in the configured safety alerts channel.

Returns
  bool dpp::g_raid_alerts_disabled flag is set

## ◆ has_role_icons()

bool dpp::guild::has_role_icons | ( |  | ) | const

guild is able to set role icons

Returns
  bool has role icons

## ◆ has_role_subscriptions()

bool dpp::guild::has_role_subscriptions | ( |  | ) | const

Has enabled role subscriptions.

Returns
  bool has enabled role subscriptions

## ◆ has_role_subscriptions_available_for_purchase()

bool dpp::guild::has_role_subscriptions_available_for_purchase | ( |  | ) | const

Guild has role subscriptions that can be purchased.

Returns
  bool has role subscriptions that can be purchased

## ◆ has_seven_day_thread_archive()

bool dpp::guild::has_seven_day_thread_archive | ( |  | ) | const

guild has access to the seven day archive time for threads

Returns
  bool has seven day thread archive

Deprecated
  Removed by Discord

## ◆ has_support_server()

bool dpp::guild::has_support_server | ( |  | ) | const

Guild has been set as a support server on the App Directory.

Returns
  bool has been set as a support server of an app in the app directory

## ◆ has_three_day_thread_archive()

bool dpp::guild::has_three_day_thread_archive | ( |  | ) | const

guild has access to the three day archive time for threads

Returns
  bool has three day thread archive

Deprecated
  Removed by Discord

## ◆ has_ticketed_events()

bool dpp::guild::has_ticketed_events | ( |  | ) | const

guild has enabled ticketed events

Returns
  bool has ticketed events

## ◆ has_vanity_url()

bool dpp::guild::has_vanity_url | ( |  | ) | const

Guild has access to set a vanity URL.

Returns
  bool can have vanity url

## ◆ has_vip_regions()

bool dpp::guild::has_vip_regions | ( |  | ) | const

Guild has access to set 384kbps bitrate in voice.

Returns
  bool can have VIP voice regions

## ◆ is_community()

bool dpp::guild::is_community | ( |  | ) | const

Has enabled community.

Returns
  bool has enabled community

## ◆ is_discoverable()

bool dpp::guild::is_discoverable | ( |  | ) | const

Guild is discoverable.

Returns
  bool is discoverable

## ◆ is_featureable()

bool dpp::guild::is_featureable | ( |  | ) | const

Guild is featurable.

Returns
  bool is featurable

## ◆ is_large()

bool dpp::guild::is_large | ( |  | ) | const

Is a large server (>250 users).

Returns
  bool is a large guild

## ◆ is_partnered()

bool dpp::guild::is_partnered | ( |  | ) | const

Guild is a discord partnered server.

Returns
  bool is discord partnered

## ◆ is_preview_enabled()

bool dpp::guild::is_preview_enabled | ( |  | ) | const

Guild has preview enabled.

Returns
  bool has preview

## ◆ is_unavailable()

bool dpp::guild::is_unavailable | ( |  | ) | const

Is unavailable due to outage (most other fields will be blank or outdated.

Returns
  bool is unavailable

## ◆ is_verified()

bool dpp::guild::is_verified | ( |  | ) | const

Guild is a verified server.

Returns
  bool is verified

## ◆ is_welcome_screen_enabled()

bool dpp::guild::is_welcome_screen_enabled | ( |  | ) | const

Guild has enabled the welcome screen.

Returns
  bool enabled welcome screen

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

## ◆ permission_overwrites() [1/2]

permission dpp::guild::permission_overwrites | ( | const guild_member & | member,
|  | const channel & | channel ) const

Get the overall permissions for a member in this channel, including channel overwrites, role permissions and admin privileges.

Parameters

  member | The member to resolve the permissions for
  channel | Channel to compute permission overwrites for

Returns
  permission Permission overwrites for the member. Made of bits in dpp::permissions.

Note
  Requires role cache to be enabled (it's enabled by default).

## ◆ permission_overwrites() [2/2]

permission dpp::guild::permission_overwrites | ( | const uint64_t | base_permissions,
|  | const user * | user,
|  | const channel * | channel ) const

Get the overall permissions for a member in this channel, including channel overwrites, role permissions and admin privileges.

Parameters

  base_permissions | base permissions before overwrites, from guild::base_permissions
  user | The user to resolve the permissions for
  channel | Channel to compute permission overwrites for

Returns
  permission Permission overwrites for the member. Made of bits in dpp::permissions.

Note
  Requires role cache to be enabled (it's enabled by default).

Warning
  The method will search for the guild member in the cache by the users id. If the guild member is not in cache, the method will always return 0.

## ◆ rehash_members()

void dpp::guild::rehash_members | ( |  | ) |

Rehash members map.

## ◆ remove_banner()

guild & dpp::guild::remove_banner | ( |  | ) |

Remove the guild banner.

Returns
  guild& Reference to self for chaining

## ◆ remove_discovery_splash()

guild & dpp::guild::remove_discovery_splash | ( |  | ) |

Remove the guild discovery splash.

Returns
  guild& Reference to self for chaining

## ◆ remove_icon()

guild & dpp::guild::remove_icon | ( |  | ) |

Remove the guild icon.

Returns
  guild& Reference to self for chaining

## ◆ remove_splash()

guild & dpp::guild::remove_splash | ( |  | ) |

Remove the guild invite splash.

Returns
  guild& Reference to self for chaining

## ◆ set_banner() [1/2]

guild & dpp::guild::set_banner | ( | image_type | format,
|  | const std::byte * | data,
|  | uint32_t | size )

Set the guild banner image. Server needs banner feature. Must be 16:9, and depending on nitro level, must be png or jpeg. Animated gif needs the animated banner server feature.

Parameters

  format | Image format.
  data | Image data in bytes
  size | Size of the data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_banner() [2/2]

guild & dpp::guild::set_banner | ( | image_type | format,
|  | std::string_view | data )

Set the guild banner image. Server needs banner feature. Must be 16:9, and depending on nitro level, must be png or jpeg. Animated gif needs the animated banner server feature.

Parameters

  format | Image format.
  data | Image data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_discovery_splash() [1/2]

guild & dpp::guild::set_discovery_splash | ( | image_type | format,
|  | const std::byte * | data,
|  | uint32_t | size )

Set the guild discovery splash image. Server needs discoverable feature. Must be 16:9 and png or jpeg.

Parameters

  format | Image format.
  data | Image data in bytes
  size | Size of the data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_discovery_splash() [2/2]

guild & dpp::guild::set_discovery_splash | ( | image_type | format,
|  | std::string_view | data )

Set the guild discovery splash image. Server needs discoverable feature. Must be 16:9 and png or jpeg.

Parameters

  format | Image format.
  data | Image data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_icon() [1/2]

guild & dpp::guild::set_icon | ( | image_type | format,
|  | const std::byte * | data,
|  | uint32_t | size )

Set the 1024x1024 guild icon image. Must be png or jpeg. Gif allowed only if the server has animated icon.

Parameters

  format | Image format.
  data | Image data in bytes
  size | Size of the data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_icon() [2/2]

guild & dpp::guild::set_icon | ( | image_type | format,
|  | std::string_view | data )

Set the guild icon image. Must be 1024x1024 and png or jpeg. Gif allowed only if the server has animated icon.

Parameters

  format | Image format.
  data | Image data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_name()

guild & dpp::guild::set_name | ( | const std::string & | n | ) |

Set the name of the guild in the object Min length: 2, Max length: 100 (not including leading/trailing spaces).

Parameters

  n | Guild name

Returns
  guild& reference to self

Exceptions

  dpp::length_exception | if guild name is too short

## ◆ set_splash() [1/2]

guild & dpp::guild::set_splash | ( | image_type | format,
|  | const std::byte * | data,
|  | uint32_t | size )

Set the guild invite splash image. Server needs invite splash feature. Must be 16:9 and png or jpeg.

Parameters

  format | Image format.
  data | Image data in bytes
  size | Size of the data in bytes

Returns
  guild& Reference to self for chaining

## ◆ set_splash() [2/2]

guild & dpp::guild::set_splash | ( | image_type | format,
|  | std::string_view | data )

Set the guild invite splash image. Server needs invite splash feature. Must be 16:9 and png or jpeg.

Parameters

  format | Image format.
  data | Image data in bytes

Returns
  guild& Reference to self for chaining

## ◆ to_json()

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

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

protected

Build a JSON from this object.

Parameters

  with_id | True if an ID is to be included in the JSON

Returns
  JSON

## ◆ widget_enabled()

bool dpp::guild::widget_enabled | ( |  | ) | const

Widget is enabled for this server.

Returns
  bool widget enabled

## Friends And Related Symbol Documentation

## ◆ json_interface< guild >

friend struct json_interface< guild >

friend

## Member Data Documentation

## ◆ afk_channel_id

snowflake dpp::guild::afk_channel_id

Snowflake ID of AFK voice channel or 0.

## ◆ afk_timeout

guild_afk_timeout_t dpp::guild::afk_timeout

Voice AFK timeout before moving users to AFK channel.

## ◆ application_id

snowflake dpp::guild::application_id

ID of creating application, if any, or 0.

## ◆ banner

utility::icon dpp::guild::banner

Server banner.

## ◆ channels

std::vector<snowflake> dpp::guild::channels

List of channels on this server.

## ◆ default_message_notifications

default_message_notification_t dpp::guild::default_message_notifications

Setting for how notifications are to be delivered to users.

## ◆ description

std::string dpp::guild::description

Server description.

## ◆ discovery_splash

utility::icon dpp::guild::discovery_splash

Guild discovery splash.

## ◆ emojis

std::vector<snowflake> dpp::guild::emojis

List of emojis.

## ◆ explicit_content_filter

guild_explicit_content_t dpp::guild::explicit_content_filter

Whether or not explicit content filtering is enable and what setting it is.

## ◆ flags

uint32_t dpp::guild::flags

Flags bitmask as defined by values within dpp::guild_flags.

## ◆ flags_extra

uint16_t dpp::guild::flags_extra

Additional flags (values from dpp::guild_flags_extra).

## ◆ icon

utility::icon dpp::guild::icon

Guild icon.

## ◆ id

snowflake dpp::managed::id = {}

inherited

Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.

## ◆ max_members

uint32_t dpp::guild::max_members

the maximum number of members for the guild

## ◆ max_presences

uint32_t dpp::guild::max_presences

the maximum number of presences for the guild.

Note
  Generally Discord always fills this with 0, apart from for the largest of guilds

## ◆ max_video_channel_users

uint8_t dpp::guild::max_video_channel_users

Maximum users in a video channel, or 0.

## ◆ member_count

uint32_t dpp::guild::member_count

Approximate member count. May be sent as zero.

## ◆ members

members_container dpp::guild::members

List of guild members.

Note
  When you first receive the guild create event, this may be empty or near empty. This depends upon your dpp::intents and the size of your bot. It will be filled by guild member chunk requests.

## ◆ mfa_level

mfa_level_t dpp::guild::mfa_level

If multi factor authentication is required for moderators or not.

## ◆ name

std::string dpp::guild::name

Guild name.

## ◆ nsfw_level

guild_nsfw_level_t dpp::guild::nsfw_level

Guild NSFW level.

## ◆ owner_id

snowflake dpp::guild::owner_id

Snowflake id of guild owner.

## ◆ premium_subscription_count

uint16_t dpp::guild::premium_subscription_count

Number of boosters.

## ◆ premium_tier

guild_premium_tier_t dpp::guild::premium_tier

Boost level.

## ◆ public_updates_channel_id

snowflake dpp::guild::public_updates_channel_id

Public updates channel id or 0.

## ◆ roles

std::vector<snowflake> dpp::guild::roles

Roles defined on this server.

## ◆ rules_channel_id

snowflake dpp::guild::rules_channel_id

ID of rules channel for communities.

## ◆ safety_alerts_channel_id

snowflake dpp::guild::safety_alerts_channel_id

The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord.

## ◆ shard_id

uint16_t dpp::guild::shard_id

Shard ID of the guild.

## ◆ splash

utility::icon dpp::guild::splash

Guild splash.

## ◆ system_channel_id

snowflake dpp::guild::system_channel_id

ID of system channel where discord update messages are sent.

## ◆ threads

std::vector<snowflake> dpp::guild::threads

List of threads on this server.

## ◆ vanity_url_code

std::string dpp::guild::vanity_url_code

Vanity url code for verified or partnered servers and boost level 3.

Note
  This field cannot be set from the API. Attempts to change this value will be silently ignored even if the correct number of boosts or verified/partnered status exist. See: https://github.com/discord/discord-api-docs/issues/519

## ◆ verification_level

verification_level_t dpp::guild::verification_level

Verification level of server.

## ◆ voice_members

std::map<snowflake, voicestate> dpp::guild::voice_members

List of members in voice channels in the guild.

## ◆ welcome_screen

dpp::welcome_screen dpp::guild::welcome_screen

Welcome screen.

## ◆ widget_channel_id

snowflake dpp::guild::widget_channel_id

Snowflake ID of widget channel, or 0.

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