DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
discord_core_api::song_api Class Reference

A class representing the song apis. More...

#include <SongAPI.hpp>

Public Member Functions

bool areWeCurrentlyPlaying () const
 Checks if there is currently playing music for the current guild. More...
 
void onSongCompletion (std::function< co_routine< void, false >(song_completion_event_data)> handler)
 For setting up behavior in response to a completed song. More...
 
bool pauseToggle ()
 Toggles pausing on and off. More...
 
bool play ()
 Plays the current song. (assuming that you are currently connected to a voice_connection). More...
 
bool play (song songNew)
 Plays the current song. (assuming that you are currently connected to a voice_connection). More...
 
jsonifier::vector< song > searchForSong (jsonifier::string_view searchQuery, uint64_t limit=20)
 Search for a song to play. More...
 
bool skip (bool wasItAfail=false)
 Skips to the next song in the queue, if applicable. More...
 
bool stop ()
 Stops the currently playing song. More...
 

Member Function Documentation

◆ areWeCurrentlyPlaying()

bool discord_core_api::song_api::areWeCurrentlyPlaying ( ) const
Returns
a bool representing the currently playing status.

Definition at line 103 of file SongAPI.cpp.

◆ onSongCompletion()

void discord_core_api::song_api::onSongCompletion ( std::function< co_routine< void, false >(song_completion_event_data)>  handler)
Parameters
handlera delegate taking a song_completion_event_data structure as an argument.

Definition at line 43 of file SongAPI.cpp.

◆ pauseToggle()

bool discord_core_api::song_api::pauseToggle ( )
Returns
a bool suggesting the success or failure of the pauseToggle command.

Definition at line 111 of file SongAPI.cpp.

◆ play() [1/2]

bool discord_core_api::song_api::play ( )
Returns
a bool suggesting the success or failure of the play command.

Definition at line 107 of file SongAPI.cpp.

◆ play() [2/2]

bool discord_core_api::song_api::play ( song  songNew)
Parameters
songNewthe song to play.
Returns
a bool suggesting the success or failure of the play command.

Definition at line 86 of file SongAPI.cpp.

Here is the call graph for this function:

◆ searchForSong()

jsonifier::vector< song > discord_core_api::song_api::searchForSong ( jsonifier::string_view  searchQuery,
uint64_t  limit = 20 
)
Parameters
searchQuerythe song to search for.
limitThe maximum number of search results to return.
Returns
a vector of song objects representing the search results.

Definition at line 56 of file SongAPI.cpp.

◆ skip()

bool discord_core_api::song_api::skip ( bool  wasItAfail = false)
Parameters
wasItAfaila bool representing whether or not this skip is due to a playing failure.
Returns
a bool suggesting the success or failure of the skip command.

Definition at line 48 of file SongAPI.cpp.

◆ stop()

bool discord_core_api::song_api::stop ( )
Returns
a bool suggesting the success or failure of the stop command.

Definition at line 115 of file SongAPI.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: