DPP supports receiving audio. This examples show how to use it to record some user in a VC.
#include <dpp/dpp.h>
#include <iomanip>
#include <sstream>
int main(int argc, char const *argv[])
{
FILE *fd;
fd = fopen("./me.pcm", "wb");
std::string command;
ss >> command;
if (command == ".record") {
"You don't seem to be on a voice channel! :("
));
}
}
if (command == ".stop") {
fclose(fd);
}
});
}
});
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition: cluster.h:271
Represents a guild on Discord (AKA a server)
Definition: guild.h:395
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.
snowflake id
Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID,...
Definition: managed.h:38
std::function< void(const dpp::log_t &)> DPP_EXPORT cout_logger()
Get a default logger that outputs to std::cout. e.g.
@ i_message_content
Intent for receipt of message content.
Definition: intents.h:64
@ i_default_intents
Default D++ intents (all non-privileged intents)
Definition: intents.h:72
uint64_t snowflake
A 64 bit unsigned value representing many things on discord. Discord calls the value a 'snowflake' va...
Definition: snowflake.h:32
DPP_EXPORT class guild * find_guild(snowflake id)
@ st_wait
Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will ...
Definition: cluster.h:254
Create message.
Definition: dispatcher.h:1354
message msg
message that was created (sent).
Definition: dispatcher.h:1363
Represents messages sent and received on Discord.
Definition: message.h:1103
user author
Definition: message.h:1109
snowflake guild_id
Definition: message.h:1107
std::string content
Definition: message.h:1113
snowflake channel_id
Definition: message.h:1105
voice receive packet
Definition: dispatcher.h:1674
size_t audio_size
Size of audio buffer.
Definition: dispatcher.h:1710
uint8_t * audio
Audio data, encoded as 48kHz stereo PCM or Opus,.
Definition: dispatcher.h:1705
snowflake user_id
User ID of speaker (zero if unknown)
Definition: dispatcher.h:1718