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

Member Function Documentation

◆ addSongToQueue()

Song DiscordCoreAPI::SongAPI::addSongToQueue ( const GuildMember guildMember,
Song song 
)
static

Adds a Song to the current Playlist's queue.

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 213 of file SongAPI.cpp.

◆ areWeCurrentlyPlaying()

Bool DiscordCoreAPI::SongAPI::areWeCurrentlyPlaying ( const Snowflake  guildId)
static

Checks if there is currently playing music for the current Guild.

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

Collects the currently playing Song.

Parameters
guildIdThe id for which Guild to collect the current Song of.
Returns
The current Song for the given Guild.

Definition at line 235 of file SongAPI.cpp.

◆ getPlaylist()

Playlist DiscordCoreAPI::SongAPI::getPlaylist ( const Snowflake  guildId)
static

Collects the Playlist from the SongAPI.

Parameters
guildIdThe Guild for which to collect the Playlist from.
Returns
A Playlist.

Definition at line 225 of file SongAPI.cpp.

◆ isLoopAllEnabled()

Bool DiscordCoreAPI::SongAPI::isLoopAllEnabled ( const Snowflake  guildId)
static

Returns the current loop-all status of the current Guild's Playlist.

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 185 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ isLoopSongEnabled()

Bool DiscordCoreAPI::SongAPI::isLoopSongEnabled ( const Snowflake  guildId)
static

Returns the current loop-song of the current Guild's Playlist.

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 193 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ isThereAnySongs()

Bool DiscordCoreAPI::SongAPI::isThereAnySongs ( const Snowflake  guildId)
static

Checks to see if there are any playable Songs in the current Playlist.

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 197 of file SongAPI.cpp.

◆ modifyQueue()

void DiscordCoreAPI::SongAPI::modifyQueue ( Int32  firstSongPosition,
Int32  secondSongPosition,
const Snowflake  guildId 
)
static

Sets the position of a Song in the current Playlist's song queue.

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 229 of file SongAPI.cpp.

◆ onSongCompletion()

void DiscordCoreAPI::SongAPI::onSongCompletion ( std::function< CoRoutine< void >(SongCompletionEventData)>  handler,
const Snowflake  guildId 
)
static

For setting up behavior in response to a completed song.

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

Toggles pausing on and off.

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

Plays the current Song. (Assuming that you are currently connected to a VoiceConnection).

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 String &  searchQuery,
const Snowflake  guildId 
)
static

Search for a Song to play.

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 160 of file SongAPI.cpp.

◆ sendNextSong()

Bool DiscordCoreAPI::SongAPI::sendNextSong ( const GuildMember guildMember)
static

Send the next playable song off of the current Guild's Playlist to be played.

Parameters
guildMemberThe GuildMember who is requesting the Song to be sent.
Returns
A Bool suggesting the success status of the send.

Definition at line 277 of file SongAPI.cpp.

◆ setCurrentSong()

void DiscordCoreAPI::SongAPI::setCurrentSong ( const Song song,
const Snowflake  guildId 
)
static

Sets the currently playing Song.

Parameters
songThe Song to set as the currently playing Song.
guildIdThe id for which Guild to set the current Song of.

Definition at line 245 of file SongAPI.cpp.

Here is the caller graph for this function:

◆ setLoopAllStatus()

void DiscordCoreAPI::SongAPI::setLoopAllStatus ( Bool  enabled,
const Snowflake  guildId 
)
static

Enables or disables the loop-all status of the playlist.

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 181 of file SongAPI.cpp.

◆ setLoopSongStatus()

void DiscordCoreAPI::SongAPI::setLoopSongStatus ( Bool  enabled,
const Snowflake  guildId 
)
static

Enables or disables the loop-song status of the playlist.

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 189 of file SongAPI.cpp.

◆ setPlaylist()

void DiscordCoreAPI::SongAPI::setPlaylist ( const Playlist playlistNew,
const Snowflake  guildId 
)
static

Sets the playlist of the desired Guild.

Parameters
playlistNewThe new Playlist to be set.
guildIdThe id of the desired Guild to set the Playlist of.

Definition at line 221 of file SongAPI.cpp.

◆ skip()

void DiscordCoreAPI::SongAPI::skip ( const GuildMember guildMember)
static

Skips to the next Song in the queue, if applicable.

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

Stops the currently playing Song.

Parameters
guildIdThe id of the Guild within which to stop the currently playing music.

Definition at line 144 of file SongAPI.cpp.


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