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

A definition of a discord thread. A thread is a superset of a channel. Not to be confused with std::thread! More...

#include <channel.h>

+ Inheritance diagram for dpp::thread:
+ Collaboration diagram for dpp::thread:

Public Member Functions

 thread ()
 Construct a new thread object. More...
 
bool is_news_thread () const
 Returns true if the channel is a news thread. More...
 
bool is_public_thread () const
 Returns true if the channel is a public thread. More...
 
bool is_private_thread () const
 Returns true if the channel is a private thread. More...
 
threadfill_from_json (nlohmann::json *j)
 
virtual ~thread ()
 Destroy the thread object. More...
 
virtual std::string build_json (bool with_id=false) const
 Build json for this thread object. More...
 
std::string get_mention () const
 Get the mention ping for the channel. More...
 
uint64_t get_user_permissions (const class user *member) const
 Get the user permissions for a user on this channel. More...
 
std::map< snowflake, class guild_member * > get_members ()
 Return a map of members on the channel, built from the guild's member list based on which members have the VIEW_CHANNEL permission. Does not return reliable information for voice channels, use dpp::channel::get_voice_members() instead for this. More...
 
std::map< snowflake, voicestateget_voice_members ()
 Get a map of members in this channel, if it is a voice channel. The map is keyed by snowflake id of the user. More...
 
bool is_nsfw () const
 Returns true if the channel is NSFW gated. More...
 
bool is_text_channel () const
 Returns true if the channel is a text channel. More...
 
bool is_dm () const
 Returns true if the channel is a DM. More...
 
bool is_voice_channel () const
 Returns true if the channel is a voice channel. More...
 
bool is_group_dm () const
 Returns true if the channel is a group DM channel. More...
 
bool is_category () const
 Returns true if the channel is a category. More...
 
bool is_news_channel () const
 Returns true if the channel is a news channel. More...
 
bool is_store_channel () const
 Returns true if the channel is a store channel. More...
 
bool is_stage_channel () const
 Returns true if the channel is a stage channel. More...
 
bool is_video_auto () const
 Returns true if video quality is auto. More...
 
bool is_video_720p () const
 Returns true if video quality is 720p. More...
 
double get_creation_time () const
 Get the creation time of this object according to Discord. More...
 

Public Attributes

uint8_t message_count
 
uint8_t member_count
 
thread_metadata metadata
 
thread_member member
 Thread member of current user if joined to the thread. Note this is only set by certain api calls otherwise contains default data. More...
 
uint16_t flags
 
snowflake guild_id
 
uint16_t position
 
std::string name
 
std::string topic
 
snowflake last_message_id
 
uint8_t user_limit
 
uint16_t bitrate
 
uint16_t rate_limit_per_user
 
snowflake owner_id
 
snowflake parent_id
 
time_t last_pin_timestamp
 
std::vector< snowflakerecipients
 
std::vector< permission_overwritepermission_overwrites
 
uint64_t permissions
 This is only filled when the channel is part of the resolved set sent within an interaction. Any other time it contains zero. When filled, it contains the calculated permission bitmask of the user issuing the command within this channel. More...
 
std::string rtc_region
 Voice region if set for voice channel, otherwise empty string. More...
 
utility::iconhash icon
 Channel icon (for group DMs) More...
 
utility::iconhash banner
 Channel banner (boost level locked) More...
 
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 relavent to us as useful metadata. More...
 

Detailed Description

A definition of a discord thread. A thread is a superset of a channel. Not to be confused with std::thread!

Constructor & Destructor Documentation

◆ thread()

dpp::thread::thread ( )

Construct a new thread object.

◆ ~thread()

virtual dpp::thread::~thread ( )
virtual

Destroy the thread object.

Member Function Documentation

◆ build_json()

virtual std::string dpp::thread::build_json ( bool  with_id = false) const
virtual

Build json for this thread object.

Parameters
with_idinclude the ID in the json
Returns
std::string JSON string

Reimplemented from dpp::channel.

◆ fill_from_json()

thread & dpp::thread::fill_from_json ( nlohmann::json j)

Read class values from json object

Parameters
jA json object to read from
Returns
A reference to self

◆ get_creation_time()

double dpp::managed::get_creation_time ( ) const
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_members()

std::map< snowflake, class guild_member * > dpp::channel::get_members ( )
inherited

Return a map of members on the channel, built from the guild's member list based on which members have the VIEW_CHANNEL permission. Does not return reliable information for voice channels, use dpp::channel::get_voice_members() instead for this.

Returns
A map of guild members keyed by user id.

◆ get_mention()

std::string dpp::channel::get_mention ( ) const
inherited

Get the mention ping for the channel.

Returns
std::string mention

◆ get_user_permissions()

uint64_t dpp::channel::get_user_permissions ( const class user member) const
inherited

Get the user permissions for a user on this channel.

Parameters
memberThe user to return permissions for
Returns
uint64_t Permissions bitmask made of bits in role_permissions. Note that if the user is not on the channel or the guild is not in the cache, the function will always return 0.

◆ get_voice_members()

std::map< snowflake, voicestate > dpp::channel::get_voice_members ( )
inherited

Get a map of members in this channel, if it is a voice channel. The map is keyed by snowflake id of the user.

Returns
std::map<snowflake, voicestate> The voice members of the channel

◆ is_category()

bool dpp::channel::is_category ( ) const
inherited

Returns true if the channel is a category.

Returns
true if a category

◆ is_dm()

bool dpp::channel::is_dm ( ) const
inherited

Returns true if the channel is a DM.

Returns
true if is a DM

◆ is_group_dm()

bool dpp::channel::is_group_dm ( ) const
inherited

Returns true if the channel is a group DM channel.

Returns
true if group DM

◆ is_news_channel()

bool dpp::channel::is_news_channel ( ) const
inherited

Returns true if the channel is a news channel.

Returns
true if news channel

◆ is_news_thread()

bool dpp::thread::is_news_thread ( ) const

Returns true if the channel is a news thread.

Returns
true if news thread

◆ is_nsfw()

bool dpp::channel::is_nsfw ( ) const
inherited

Returns true if the channel is NSFW gated.

Returns
true if NSFW

◆ is_private_thread()

bool dpp::thread::is_private_thread ( ) const

Returns true if the channel is a private thread.

Returns
true if private thread

◆ is_public_thread()

bool dpp::thread::is_public_thread ( ) const

Returns true if the channel is a public thread.

Returns
true if public thread

◆ is_stage_channel()

bool dpp::channel::is_stage_channel ( ) const
inherited

Returns true if the channel is a stage channel.

Returns
true if stage channel

◆ is_store_channel()

bool dpp::channel::is_store_channel ( ) const
inherited

Returns true if the channel is a store channel.

Returns
true if store channel

◆ is_text_channel()

bool dpp::channel::is_text_channel ( ) const
inherited

Returns true if the channel is a text channel.

Returns
true if text channel

◆ is_video_720p()

bool dpp::channel::is_video_720p ( ) const
inherited

Returns true if video quality is 720p.

Returns
true if video quality is 720p

◆ is_video_auto()

bool dpp::channel::is_video_auto ( ) const
inherited

Returns true if video quality is auto.

Returns
true if video quality is auto

◆ is_voice_channel()

bool dpp::channel::is_voice_channel ( ) const
inherited

Returns true if the channel is a voice channel.

Returns
true if voice channel

Member Data Documentation

◆ banner

utility::iconhash dpp::channel::banner
inherited

Channel banner (boost level locked)

◆ bitrate

uint16_t dpp::channel::bitrate
inherited

the bitrate (in bits) of the voice channel

◆ flags

uint16_t dpp::channel::flags
inherited

Flags bitmap

◆ guild_id

snowflake dpp::channel::guild_id
inherited

Guild id of the guild that owns the channel

◆ icon

utility::iconhash dpp::channel::icon
inherited

Channel icon (for group DMs)

◆ 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 relavent to us as useful metadata.

◆ last_message_id

snowflake dpp::channel::last_message_id
inherited

ID of last message to be sent to the channel

◆ last_pin_timestamp

time_t dpp::channel::last_pin_timestamp
inherited

Timestamp of last pinned message

◆ member

thread_member dpp::thread::member

Thread member of current user if joined to the thread. Note this is only set by certain api calls otherwise contains default data.

◆ member_count

uint8_t dpp::thread::member_count

Approximate count of members in a thread (threads)

◆ message_count

uint8_t dpp::thread::message_count

Approximate count of messages in a thread (threads)

◆ metadata

thread_metadata dpp::thread::metadata

Thread metadata (threads)

◆ name

std::string dpp::channel::name
inherited

Channel name

◆ owner_id

snowflake dpp::channel::owner_id
inherited

User ID of owner for group DMs

◆ parent_id

snowflake dpp::channel::parent_id
inherited

Parent ID (category)

◆ permission_overwrites

std::vector<permission_overwrite> dpp::channel::permission_overwrites
inherited

Permission overwrites to apply to base permissions

◆ permissions

uint64_t dpp::channel::permissions
inherited

This is only filled when the channel is part of the resolved set sent within an interaction. Any other time it contains zero. When filled, it contains the calculated permission bitmask of the user issuing the command within this channel.

◆ position

uint16_t dpp::channel::position
inherited

Sorting position, lower number means higher up the list

◆ rate_limit_per_user

uint16_t dpp::channel::rate_limit_per_user
inherited

amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected

◆ recipients

std::vector<snowflake> dpp::channel::recipients
inherited

DM recipients

◆ rtc_region

std::string dpp::channel::rtc_region
inherited

Voice region if set for voice channel, otherwise empty string.

◆ topic

std::string dpp::channel::topic
inherited

Channel topic

◆ user_limit

uint8_t dpp::channel::user_limit
inherited

Maximum user limit for voice channels (0-99)

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0