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

Search
Loading...
Searching...
No Matches
dpp::attachment Struct Reference

Represents an attachment in a dpp::message. More...

`#include <message.h>`

Collaboration diagram for dpp::attachment:
[legend]

## Public Member Functions

| attachment (struct message *o)
| Constructs a new attachment object.
| attachment (struct message *o, nlohmann::json *j)
| Constructs a new attachment object from a JSON object.
| ~attachment ()=default
| Destructs the attachment object.
void | download (http_completion_event callback) const
| Download this attachment.
time_t | get_expire_time () const
| Returns expiration timestamp for attachment's URL.
time_t | get_issued_time () const
| Returns creation timestamp for attachment's URL.
bool | is_remix () const
| Returns true if remixed.

## Public Attributes

std::string | content_type
| MIME type of the attachment, if applicable.
std::string | description
| Optional: Description of the attachment. Max 1024 characters.
double | duration_secs
| The duration of the audio file.
bool | ephemeral
| Whether this attachment is ephemeral, if applicable.
std::string | filename
| File name of the attachment.
uint8_t | flags
| Flags made from dpp::attachment_flags.
uint32_t | height
| Height of the attachment, if applicable.
snowflake | id
| ID of attachment.
struct message * | owner
| Owning message.
std::string | proxy_url
| Proxied URL which points to the attachment.
uint32_t | size
| Size of the attachment in bytes.
std::string | url
| URL which points to the attachment.
std::string | waveform
| Base64 encoded bytearray representing a sampled waveform.
uint32_t | width
| Width of the attachment, if applicable.

## Detailed Description

Represents an attachment in a dpp::message.

## Constructor & Destructor Documentation

## ◆ attachment() [1/2]

dpp::attachment::attachment | ( | struct message * | o | ) |

Constructs a new attachment object.

Parameters

  o | Owning dpp::message object

## ◆ attachment() [2/2]

dpp::attachment::attachment | ( | struct message * | o,
|  | nlohmann::json * | j )

Constructs a new attachment object from a JSON object.

Parameters

  o | Owning dpp::message object
  j | JSON to read information from

## ◆ ~attachment()

dpp::attachment::~attachment | ( |  | ) |

default

Destructs the attachment object.

## Member Function Documentation

## ◆ download()

void dpp::attachment::download | ( | http_completion_event | callback | ) | const

Download this attachment.

Parameters

  callback | A callback which is called when the download completes.

Note
  The content of the file will be in the http_info.body parameter of the callback parameter.

Exceptions

  dpp::logic_exception | If there is no owner associated with this attachment that itself has an owning cluster, this method will throw a dpp::logic_exception when called.

## ◆ get_expire_time()

time_t dpp::attachment::get_expire_time | ( |  | ) | const

Returns expiration timestamp for attachment's URL.

Returns
  timestamp of URL expiration

## ◆ get_issued_time()

time_t dpp::attachment::get_issued_time | ( |  | ) | const

Returns creation timestamp for attachment's URL.

Returns
  timestamp of URL creation

## ◆ is_remix()

bool dpp::attachment::is_remix | ( |  | ) | const

Returns true if remixed.

Returns
  true if remixed

## Member Data Documentation

## ◆ content_type

std::string dpp::attachment::content_type

MIME type of the attachment, if applicable.

## ◆ description

std::string dpp::attachment::description

Optional: Description of the attachment. Max 1024 characters.

## ◆ duration_secs

double dpp::attachment::duration_secs

The duration of the audio file.

Note
  Currently for voice messages.

## ◆ ephemeral

bool dpp::attachment::ephemeral

Whether this attachment is ephemeral, if applicable.

## ◆ filename

std::string dpp::attachment::filename

File name of the attachment.

## ◆ flags

uint8_t dpp::attachment::flags

Flags made from dpp::attachment_flags.

## ◆ height

uint32_t dpp::attachment::height

Height of the attachment, if applicable.

## ◆ id

snowflake dpp::attachment::id

ID of attachment.

## ◆ owner

struct message* dpp::attachment::owner

Owning message.

## ◆ proxy_url

std::string dpp::attachment::proxy_url

Proxied URL which points to the attachment.

## ◆ size

uint32_t dpp::attachment::size

Size of the attachment in bytes.

## ◆ url

std::string dpp::attachment::url

URL which points to the attachment.

## ◆ waveform

std::string dpp::attachment::waveform

Base64 encoded bytearray representing a sampled waveform.

Note
  Currently for voice messages.

## ◆ width

uint32_t dpp::attachment::width

Width of the attachment, if applicable.

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