Discord Social SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
discordpp::ChannelHandle Class Reference

Detailed Description

All messages sent on Discord are done so in a Channel. MessageHandle::ChannelId will contain the ID of the channel a message was sent in, and Client::GetChannelHandle will return an instance of this class.

Handle objects in the SDK hold a reference both to the underlying data, and to the SDK instance. Changes to the underlying data will generally be available on existing handles objects without having to re-create them. If the SDK instance is destroyed, but you still have a reference to a handle object, note that it will return the default value for all method calls (ie an empty string for methods that return a string).

Public Member Functions

 ChannelHandle (ChannelHandle &&other) noexcept
 Move constructor for ChannelHandle.
 
ChannelHandleoperator= (ChannelHandle &&other) noexcept
 Move assignment operator for ChannelHandle.
 
 operator bool () const
 Returns true if the instance contains a valid object.
 
 ChannelHandle (const ChannelHandle &other)
 Copy constructor for ChannelHandle.
 
ChannelHandleoperator= (const ChannelHandle &other)
 Copy assignment operator for ChannelHandle.
 
uint64_t Id () const
 Returns the ID of the channel.
 
std::string Name () const
 Returns the name of the channel.
 
std::vector< uint64_t > Recipients () const
 For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels returns an empty list.
 
discordpp::ChannelType Type () const
 Returns the type of the channel.
 

Static Public Attributes

static const ChannelHandle nullobj
 Uninitialized instance of ChannelHandle.
 

Constructor & Destructor Documentation

◆ ChannelHandle() [1/2]

discordpp::ChannelHandle::ChannelHandle ( ChannelHandle && other)
noexcept

Move constructor for ChannelHandle.

◆ ChannelHandle() [2/2]

discordpp::ChannelHandle::ChannelHandle ( const ChannelHandle & other)

Copy constructor for ChannelHandle.

Member Function Documentation

◆ Id()

uint64_t discordpp::ChannelHandle::Id ( ) const

Returns the ID of the channel.

◆ Name()

std::string discordpp::ChannelHandle::Name ( ) const

Returns the name of the channel.

Generally only channels in servers have names, although Discord may generate a display name for some channels as well.

◆ operator bool()

discordpp::ChannelHandle::operator bool ( ) const
inline

Returns true if the instance contains a valid object.

◆ operator=() [1/2]

ChannelHandle & discordpp::ChannelHandle::operator= ( ChannelHandle && other)
noexcept

Move assignment operator for ChannelHandle.

◆ operator=() [2/2]

ChannelHandle & discordpp::ChannelHandle::operator= ( const ChannelHandle & other)

Copy assignment operator for ChannelHandle.

◆ Recipients()

std::vector< uint64_t > discordpp::ChannelHandle::Recipients ( ) const

For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels returns an empty list.

◆ Type()

discordpp::ChannelType discordpp::ChannelHandle::Type ( ) const

Returns the type of the channel.

Member Data Documentation

◆ nullobj

const ChannelHandle discordpp::ChannelHandle::nullobj
static

Uninitialized instance of ChannelHandle.