D++ (DPP)
C++ Discord API Bot Library
|
Represents a guild on Discord (AKA a server) More...
#include <guild.h>
Public Member Functions | |
guild () | |
virtual | ~guild ()=default |
Destroy the guild object. More... | |
guild & | fill_from_json (nlohmann::json *j) |
guild & | fill_from_json (class discord_client *shard, nlohmann::json *j) |
virtual std::string | build_json (bool with_id=false) const |
uint64_t | base_permissions (const class user *member) const |
Get the base permissions for a member on this guild, before permission overwrites are applied. More... | |
uint64_t | permission_overwrites (const uint64_t base_permissions, const user *member, const channel *channel) const |
Get the permission overwrites for a member merged into a bitmask. More... | |
void | rehash_members () |
Rehash members map. More... | |
bool | connect_member_voice (snowflake user_id, bool self_mute=false, bool self_deaf=false) |
Connect to a voice channel another guild member is in. More... | |
std::string | get_banner_url (uint16_t size=0) const |
Get the banner url of the guild if it have one, otherwise returns an empty string. More... | |
std::string | get_discovery_splash_url (uint16_t size=0) const |
Get the discovery splash url of the guild if it have one, otherwise returns an empty string. More... | |
std::string | get_icon_url (uint16_t size=0) const |
Get the icon url of the guild if it have one, otherwise returns an empty string. More... | |
std::string | get_splash_url (uint16_t size=0) const |
Get the splash url of the guild if it have one, otherwise returns an empty string. More... | |
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) More... | |
bool | is_large () const |
Is a large server (>250 users) More... | |
bool | is_unavailable () const |
Is unavailable due to outage (most other fields will be blank or outdated. More... | |
bool | widget_enabled () const |
Widget is enabled for this server. More... | |
bool | has_invite_splash () const |
Guild has an invite splash. More... | |
bool | has_vip_regions () const |
Guild has VIP voice regions. More... | |
bool | has_vanity_url () const |
Guild can have a vanity url. More... | |
bool | is_verified () const |
Guild is a verified server. More... | |
bool | is_partnered () const |
Guild is a discord partnered server. More... | |
bool | is_community () const |
Has enabled community. More... | |
bool | has_commerce () const |
Guild has commerce channels. More... | |
bool | has_news () const |
Guild has news channels. More... | |
bool | is_discoverable () const |
Guild is discoverable. More... | |
bool | is_featureable () const |
Guild is featurable. More... | |
bool | has_animated_icon () const |
Guild can have an animated icon. More... | |
bool | has_banner () const |
Guild has a banner image. More... | |
bool | is_welcome_screen_enabled () const |
Guild has enabled the welcome screen. More... | |
bool | has_member_verification_gate () const |
Guild has membership screening. More... | |
bool | is_preview_enabled () const |
Guild has preview enabled. More... | |
bool | has_animated_icon_hash () const |
Guild icon is actually an animated gif. More... | |
bool | has_animated_banner_icon_hash () const |
Guild banner is animated gif. More... | |
bool | has_monetization_enabled () const |
guild has access to monetization features More... | |
bool | has_more_stickers () const |
guild has increased custom sticker slots More... | |
bool | has_private_threads () const |
guild has access to create private threads More... | |
bool | has_role_icons () const |
guild is able to set role icons More... | |
bool | has_seven_day_thread_archive () const |
guild has access to the seven day archive time for threads More... | |
bool | has_three_day_thread_archive () const |
guild has access to the three day archive time for threads More... | |
bool | has_ticketed_events () const |
guild has enabled ticketed events More... | |
bool | has_channel_banners () const |
guild has access to channel banners feature More... | |
double | get_creation_time () const |
Get the creation time of this object according to Discord. More... | |
guild & | parse_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
Represents a guild on Discord (AKA a server)
dpp::guild::guild | ( | ) |
Default constructor, zeroes all values
|
virtualdefault |
Destroy the guild object.
uint64_t dpp::guild::base_permissions | ( | const class user * | member | ) | const |
Get the base permissions for a member on this guild, before permission overwrites are applied.
member | member to get permissions for |
|
virtual |
Build a JSON string from this object.
with_id | True if an ID is to be included in the JSON |
Reimplemented from dpp::json_interface< guild >.
bool dpp::guild::connect_member_voice | ( | snowflake | user_id, |
bool | self_mute = false , |
||
bool | self_deaf = false |
||
) |
Connect to a voice channel another guild member is in.
user_id | User id to join |
self_mute | True if the bot should mute itself |
self_deaf | True if the bot should deafen itself |
guild & dpp::guild::fill_from_json | ( | class discord_client * | shard, |
nlohmann::json * | j | ||
) |
Read class values from json object
shard | originating shard |
j | A json object to read from |
guild & dpp::guild::fill_from_json | ( | nlohmann::json * | j | ) |
Read class values from json object
j | A json object to read from |
std::string dpp::guild::get_banner_url | ( | uint16_t | size = 0 | ) | const |
Get the banner url of the guild if it have one, otherwise returns an empty string.
size | The size of the banner in pixels. It can be any power of two between 16 and 4096. if not specified, the default sized banner is returned. |
|
inherited |
Get the creation time of this object according to Discord.
std::string dpp::guild::get_discovery_splash_url | ( | uint16_t | size = 0 | ) | const |
Get the discovery splash url of the guild if it have one, otherwise returns an empty string.
size | The size of the discovery splash in pixels. It can be any power of two between 16 and 4096. if not specified, the default sized discovery splash is returned. |
std::string dpp::guild::get_icon_url | ( | uint16_t | size = 0 | ) | const |
Get the icon url of the guild if it have one, otherwise returns an empty string.
size | The size of the icon in pixels. It can be any power of two between 16 and 4096. if not specified, the default sized icon is returned. |
std::string dpp::guild::get_splash_url | ( | uint16_t | size = 0 | ) | const |
Get the splash url of the guild if it have one, otherwise returns an empty string.
size | The size of the splash in pixels. It can be any power of two between 16 and 4096. if not specified, the default sized splash is returned. |
bool dpp::guild::has_animated_banner_icon_hash | ( | ) | const |
Guild banner is animated gif.
bool dpp::guild::has_animated_icon | ( | ) | const |
Guild can have an animated icon.
bool dpp::guild::has_animated_icon_hash | ( | ) | const |
Guild icon is actually an animated gif.
bool dpp::guild::has_banner | ( | ) | const |
Guild has a banner image.
bool dpp::guild::has_channel_banners | ( | ) | const |
guild has access to channel banners feature
bool dpp::guild::has_commerce | ( | ) | const |
Guild has commerce channels.
bool dpp::guild::has_invite_splash | ( | ) | const |
Guild has an invite splash.
bool dpp::guild::has_member_verification_gate | ( | ) | const |
Guild has membership screening.
bool dpp::guild::has_monetization_enabled | ( | ) | const |
guild has access to monetization features
bool dpp::guild::has_more_stickers | ( | ) | const |
guild has increased custom sticker slots
bool dpp::guild::has_news | ( | ) | const |
Guild has news channels.
bool dpp::guild::has_private_threads | ( | ) | const |
guild has access to create private threads
bool dpp::guild::has_role_icons | ( | ) | const |
guild is able to set role icons
bool dpp::guild::has_seven_day_thread_archive | ( | ) | const |
guild has access to the seven day archive time for threads
bool dpp::guild::has_three_day_thread_archive | ( | ) | const |
guild has access to the three day archive time for threads
bool dpp::guild::has_ticketed_events | ( | ) | const |
guild has enabled ticketed events
bool dpp::guild::has_vanity_url | ( | ) | const |
Guild can have a vanity url.
bool dpp::guild::has_vip_regions | ( | ) | const |
Guild has VIP voice regions.
bool dpp::guild::is_community | ( | ) | const |
Has enabled community.
bool dpp::guild::is_discoverable | ( | ) | const |
Guild is discoverable.
bool dpp::guild::is_featureable | ( | ) | const |
Guild is featurable.
bool dpp::guild::is_large | ( | ) | const |
Is a large server (>250 users)
bool dpp::guild::is_partnered | ( | ) | const |
Guild is a discord partnered server.
bool dpp::guild::is_preview_enabled | ( | ) | const |
Guild has preview enabled.
bool dpp::guild::is_unavailable | ( | ) | const |
Is unavailable due to outage (most other fields will be blank or outdated.
bool dpp::guild::is_verified | ( | ) | const |
Guild is a verified server.
bool dpp::guild::is_welcome_screen_enabled | ( | ) | const |
Guild has enabled the welcome screen.
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
uint64_t dpp::guild::permission_overwrites | ( | const uint64_t | base_permissions, |
const user * | member, | ||
const channel * | channel | ||
) | const |
Get the permission overwrites for a member merged into a bitmask.
base_permissions | base permissions before overwrites, from channel::base_permissions |
member | Member to fetch permissions for |
channel | Channel to fetch permissions against |
void dpp::guild::rehash_members | ( | ) |
Rehash members map.
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)
n | Guild name |
dpp::length_exception | if guild name is too short |
bool dpp::guild::widget_enabled | ( | ) | const |
Widget is enabled for this server.
snowflake dpp::guild::afk_channel_id |
Snowflake ID of AFK voice channel or 0
uint8_t dpp::guild::afk_timeout |
Voice AFK timeout before moving users to AFK channel
snowflake dpp::guild::application_id |
ID of creating application, if any, or 0
utility::iconhash dpp::guild::banner |
Server banner hash
std::vector<snowflake> dpp::guild::channels |
List of channels on this server
uint8_t dpp::guild::default_message_notifications |
Setting for how notifications are to be delivered to users
std::string dpp::guild::description |
Server description for communities
utility::iconhash dpp::guild::discovery_splash |
Guild discovery splash hash
std::vector<snowflake> dpp::guild::emojis |
List of emojis
guild_explicit_content_t dpp::guild::explicit_content_filter |
Whether or not explicit content filtering is enable and what setting it is
uint32_t dpp::guild::flags |
Flags bitmask as defined by values within dpp::guild_flags
utility::iconhash dpp::guild::icon |
Guild icon hash
|
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.
uint32_t dpp::guild::max_members |
the maximum number of members for the guild
uint32_t dpp::guild::max_presences |
the maximum number of presences for the guild.
uint16_t dpp::guild::max_video_channel_users |
Maximum users in a video channel, or 0
uint32_t dpp::guild::member_count |
Approximate member count. May be sent as zero
members_container dpp::guild::members |
List of guild members. Note that 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_t dpp::guild::mfa_level |
If multi factor authentication is required for moderators or not
std::string dpp::guild::name |
Guild name
guild_nsfw_level_t dpp::guild::nsfw_level |
Guild NSFW level.
snowflake dpp::guild::owner_id |
Snowflake id of guild owner
uint16_t dpp::guild::premium_subscription_count |
Number of boosters
uint8_t dpp::guild::premium_tier |
Boost level
snowflake dpp::guild::public_updates_channel_id |
Public updates channel id or 0
std::vector<snowflake> dpp::guild::roles |
Roles defined on this server
snowflake dpp::guild::rules_channel_id |
ID of rules channel for communities
uint16_t dpp::guild::shard_id |
Shard ID of the guild
utility::iconhash dpp::guild::splash |
Guild splash hash
snowflake dpp::guild::system_channel_id |
ID of system channel where discord update messages are sent
std::vector<snowflake> dpp::guild::threads |
List of threads on this server
std::string dpp::guild::vanity_url_code |
Vanity url code for verified or partnered servers and boost level 3.
verification_level_t dpp::guild::verification_level |
Verification level of server
std::map<snowflake, voicestate> dpp::guild::voice_members |
List of members in voice channels in the guild.
welcome_screen_t dpp::guild::welcome_screen |
Welcome screen
snowflake dpp::guild::widget_channel_id |
Snowflake ID of widget channel, or 0