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

A class representing the Song APIs. More...

#include <SongAPI.hpp>

Static Public Member Functions

static Song addSongToQueue (const GuildMember &guildMember, Song &song)
 Adds a Song to the current Playlist's queue.
 
static bool areWeCurrentlyPlaying (const Snowflake guildId)
 Checks if there is currently playing music for the current Guild.
 
static Song getCurrentSong (const Snowflake guildId)
 Collects the currently playing Song.
 
static Playlist getPlaylist (const Snowflake guildId)
 Collects the Playlist from the SongAPI.
 
static bool isLoopAllEnabled (const Snowflake guildId)
 Returns the current loop-all status of the current Guild's Playlist.
 
static bool isLoopSongEnabled (const Snowflake guildId)
 Returns the current loop-song of the current Guild's Playlist.
 
static bool isThereAnySongs (const Snowflake guildId)
 Checks to see if there are any playable Songs in the current Playlist.
 
static void modifyQueue (int32_t firstSongPosition, int32_t secondSongPosition, const Snowflake guildId)
 Sets the position of a Song in the current Playlist's song queue.
 
static void onSongCompletion (std::function< CoRoutine< void >(SongCompletionEventData)> handler, const Snowflake guildId)
 For setting up behavior in response to a completed song.
 
static void pauseToggle (const Snowflake guildId)
 Toggles pausing on and off.
 
static bool play (const Snowflake guildId)
 Plays the current Song. (Assuming that you are currently connected to a VoiceConnection).
 
static std::vector< SongsearchForSong (const std::string &searchQuery, const Snowflake guildId)
 Search for a Song to play.
 
static bool sendNextSong (const GuildMember &guildMember)
 Send the next playable song off of the current Guild's Playlist to be played.
 
static void setCurrentSong (const Song &song, const Snowflake guildId)
 Sets the currently playing Song.
 
static void setLoopAllStatus (bool enabled, const Snowflake guildId)
 Enables or disables the loop-all status of the playlist.
 
static void setLoopSongStatus (bool enabled, const Snowflake guildId)
 Enables or disables the loop-song status of the playlist.
 
static void setPlaylist (const Playlist &playlistNew, const Snowflake guildId)
 Sets the playlist of the desired Guild.
 
static void skip (const GuildMember &guildMember)
 Skips to the next Song in the queue, if applicable.
 
static void stop (const Snowflake guildId)
 Stops the currently playing Song.
 

Member Function Documentation

◆ addSongToQueue()

Song DiscordCoreAPI::SongAPI::addSongToQueue ( const GuildMember guildMember,
Song song 
)
static
Parameters
guildMemberThe GuildMember that is adding the Song to the queue.
songThe Song to be added to the queue.
Returns
The Song that was added to the queue.

Definition at line 215 of file SongAPI.cpp.

◆ areWeCurrentlyPlaying()

bool DiscordCoreAPI::SongAPI::areWeCurrentlyPlaying ( const Snowflake  guildId)
static
Parameters
guildIdThe id for the desired Guild to check the current playing status.
Returns
A bool representing the currently playing status.

Definition at line 124 of file SongAPI.cpp.

◆ getCurrentSong()

Song DiscordCoreAPI::SongAPI::getCurrentSong ( const Snowflake  guildId)
static
Parameters
guildIdThe id for which Guild to collect the current Song of.
Returns
The current Song for the given Guild.

Definition at line 237 of file SongAPI.cpp.

◆ getPlaylist()

Playlist DiscordCoreAPI::SongAPI::getPlaylist ( const Snowflake  guildId)
static
Parameters
guildIdThe Guild for which to collect the Playlist from.
Returns
A Playlist.

Definition at line 226 of file SongAPI.cpp.

◆ isLoopAllEnabled()

bool DiscordCoreAPI::SongAPI::isLoopAllEnabled ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild for which you would like to check the loop-all status of.
Returns
A bool representing the current loop-all status.

Definition at line 186 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ isLoopSongEnabled()

bool DiscordCoreAPI::SongAPI::isLoopSongEnabled ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild for which you would like to check the loop-song status of.
Returns
A bool representing the current loop-song status.

Definition at line 194 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ isThereAnySongs()

bool DiscordCoreAPI::SongAPI::isThereAnySongs ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild for which we would like to check its Playlist for Songs.
Returns
A bool representing whether there are any playable Songs.

Definition at line 198 of file SongAPI.cpp.

◆ modifyQueue()

void DiscordCoreAPI::SongAPI::modifyQueue ( int32_t  firstSongPosition,
int32_t  secondSongPosition,
const Snowflake  guildId 
)
static
Parameters
firstSongPositionThe first Song's initial position.
secondSongPositionThe first Song's final position.
guildIdThe id of the desired Guild to update the Song positions in.

Definition at line 230 of file SongAPI.cpp.

◆ onSongCompletion()

void DiscordCoreAPI::SongAPI::onSongCompletion ( std::function< CoRoutine< void >(SongCompletionEventData)>  handler,
const Snowflake  guildId 
)
static
Parameters
handlerA delegate taking a SongCompletionEventData structure as an argument.
guildIdThe id of the Guild for which you would like to instantiate this event.

Definition at line 38 of file SongAPI.cpp.

◆ pauseToggle()

void DiscordCoreAPI::SongAPI::pauseToggle ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild which you would like to pause the Song for.

Definition at line 120 of file SongAPI.cpp.

◆ play()

bool DiscordCoreAPI::SongAPI::play ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild within which to play the current Song.
Returns
A bool suggesting the success or failure of the play command.

Definition at line 116 of file SongAPI.cpp.

◆ searchForSong()

std::vector< Song > DiscordCoreAPI::SongAPI::searchForSong ( const std::string &  searchQuery,
const Snowflake  guildId 
)
static
Parameters
searchQueryThe Song to search for.
guildIdThe Guild id to search for the Song within.
Returns
A vector of Song objects representing the search results.

Definition at line 161 of file SongAPI.cpp.

◆ sendNextSong()

bool DiscordCoreAPI::SongAPI::sendNextSong ( const GuildMember guildMember)
static
Parameters
guildMemberThe GuildMember who is requesting the Song to be sent.
Returns
A bool suggesting the success status of the send.

Definition at line 269 of file SongAPI.cpp.

◆ setCurrentSong()

void DiscordCoreAPI::SongAPI::setCurrentSong ( const Song song,
const Snowflake  guildId 
)
static
Parameters
songThe Song to set as the currently playing Song.
guildIdThe id for which Guild to set the current Song of.

Definition at line 247 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ setLoopAllStatus()

void DiscordCoreAPI::SongAPI::setLoopAllStatus ( bool  enabled,
const Snowflake  guildId 
)
static
Parameters
enabledA bool representing whether or not to enable the loop-all status.
guildIdThe Guild id for which Guild to update this status in.

Definition at line 182 of file SongAPI.cpp.

◆ setLoopSongStatus()

void DiscordCoreAPI::SongAPI::setLoopSongStatus ( bool  enabled,
const Snowflake  guildId 
)
static
Parameters
enabledA bool representing whether or not to enable the loop-song status.
guildIdThe Guild id for which Guild to update this status in.

Definition at line 190 of file SongAPI.cpp.

◆ setPlaylist()

void DiscordCoreAPI::SongAPI::setPlaylist ( const Playlist playlistNew,
const Snowflake  guildId 
)
static
Parameters
playlistNewThe new Playlist to be set.
guildIdThe id of the desired Guild to set the Playlist of.

Definition at line 222 of file SongAPI.cpp.

◆ skip()

void DiscordCoreAPI::SongAPI::skip ( const GuildMember guildMember)
static
Parameters
guildMemberThe GuildMember structure of the individual who is skipping the Song.

Definition at line 128 of file SongAPI.cpp.

Here is the call graph for this function:

◆ stop()

void DiscordCoreAPI::SongAPI::stop ( const Snowflake  guildId)
static
Parameters
guildIdThe id of the Guild within which to stop the currently playing music.

Definition at line 145 of file SongAPI.cpp.


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