public class eRadio
extends net.dv8tion.jda.core.hooks.ListenerAdapter
Modifier and Type | Field and Description |
---|---|
private com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager |
playerManager |
private com.sedmelluq.discord.lavaplayer.track.AudioTrack |
station
The audio form of the station.
|
private java.lang.String |
stationURL
Radio station's URL.
|
private java.lang.String |
voiceChannel
VoiceChannel that the bot will play in.
|
Modifier | Constructor and Description |
---|---|
private |
eRadio(java.lang.String stationURL,
java.lang.String voiceChannel)
Initializes the bot with the station and VoiceChannel.
|
Modifier and Type | Method and Description |
---|---|
private GuildMusicManager |
getGuildAudioPlayer(net.dv8tion.jda.core.entities.Guild guild)
Creates the
GuildMusicManager to handle the music being played. |
private void |
joinVoice(net.dv8tion.jda.core.entities.Guild guild,
net.dv8tion.jda.core.entities.TextChannel channel)
Joins the
voiceChannel specified by the bot.properties file if possible. |
private void |
loadAndPlay(net.dv8tion.jda.core.entities.TextChannel channel)
Loads the station and then calls
play(Guild, TextChannel, GuildMusicManager, AudioTrack) . |
static void |
main(java.lang.String[] args)
Starts the bot with the given arguments (from command line or bot.properties).
|
private void |
nowPlaying(net.dv8tion.jda.core.entities.TextChannel channel)
Sends the currently playing song's info to channel as a message.
|
void |
onMessageReceived(net.dv8tion.jda.core.events.message.MessageReceivedEvent event)
Handles getting and executing commands.
|
private void |
play(net.dv8tion.jda.core.entities.Guild guild,
net.dv8tion.jda.core.entities.TextChannel channel,
GuildMusicManager musicManager,
com.sedmelluq.discord.lavaplayer.track.AudioTrack radioStation)
Joins the
VoiceChannel specified by voiceChannel , then queues the station , and finally
sends a message confirming the start or continued play of the radio. |
private void |
sendCommands(net.dv8tion.jda.core.entities.User user)
Sends a list of commands the bot has available to the command user.
|
private void |
stopPlayer(net.dv8tion.jda.core.entities.TextChannel channel)
Stops the player if playing and sends a confirmation message.
|
onCallCreate, onCallDelete, onCallUpdateRegion, onCallUpdateRingingUsers, onCallVoiceJoin, onCallVoiceLeave, onCallVoiceSelfDeafen, onCallVoiceSelfMute, onDisconnect, onEvent, onFriendAdded, onFriendRemoved, onFriendRequestCanceled, onFriendRequestIgnored, onFriendRequestReceived, onFriendRequestSent, onGenericCall, onGenericCallUpdate, onGenericCallVoice, onGenericEvent, onGenericGroup, onGenericGroupMessage, onGenericGroupUpdate, onGenericGuild, onGenericGuildMember, onGenericGuildMessage, onGenericGuildUpdate, onGenericGuildVoice, onGenericMessage, onGenericMessageReaction, onGenericPrivateMessage, onGenericRelationship, onGenericRelationshipAdd, onGenericRelationshipRemove, onGenericRole, onGenericRoleUpdate, onGenericSelfUpdate, onGenericTextChannel, onGenericTextChannelUpdate, onGenericUser, onGenericVoiceChannel, onGenericVoiceChannelUpdate, onGroupJoin, onGroupLeave, onGroupMessageDelete, onGroupMessageEmbed, onGroupMessageReceived, onGroupMessageUpdate, onGroupUpdateIcon, onGroupUpdateName, onGroupUpdateOwner, onGroupUserJoin, onGroupUserLeave, onGuildAvailable, onGuildBan, onGuildJoin, onGuildLeave, onGuildMemberJoin, onGuildMemberLeave, onGuildMemberNickChange, onGuildMemberRoleAdd, onGuildMemberRoleRemove, onGuildMessageDelete, onGuildMessageEmbed, onGuildMessageReceived, onGuildMessageUpdate, onGuildUnavailable, onGuildUnban, onGuildUpdateAfkChannel, onGuildUpdateAfkTimeout, onGuildUpdateIcon, onGuildUpdateMFALevel, onGuildUpdateName, onGuildUpdateNotificationLevel, onGuildUpdateOwner, onGuildUpdateRegion, onGuildUpdateSplash, onGuildUpdateVerificationLevel, onGuildVoiceDeafen, onGuildVoiceGuildDeafen, onGuildVoiceGuildMute, onGuildVoiceJoin, onGuildVoiceLeave, onGuildVoiceMove, onGuildVoiceMute, onGuildVoiceSelfDeafen, onGuildVoiceSelfMute, onGuildVoiceSuppress, onMessageBulkDelete, onMessageDelete, onMessageEmbed, onMessageReactionAdd, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageUpdate, onPrivateChannelCreate, onPrivateChannelDelete, onPrivateMessageDelete, onPrivateMessageEmbed, onPrivateMessageReceived, onPrivateMessageUpdate, onReady, onReconnect, onResume, onRoleCreate, onRoleDelete, onRoleUpdateColor, onRoleUpdateHoisted, onRoleUpdateMentionable, onRoleUpdateName, onRoleUpdatePermissions, onRoleUpdatePosition, onSelfUpdateAvatar, onSelfUpdateEmail, onSelfUpdateMFA, onSelfUpdateName, onSelfUpdateVerified, onShutdown, onStatusChange, onTextChannelCreate, onTextChannelDelete, onTextChannelUpdateName, onTextChannelUpdatePermissions, onTextChannelUpdatePosition, onTextChannelUpdateTopic, onUnavailableGuildJoined, onUserAvatarUpdate, onUserBlocked, onUserGameUpdate, onUserNameUpdate, onUserOnlineStatusUpdate, onUserTyping, onUserUnblocked, onVoiceChannelCreate, onVoiceChannelDelete, onVoiceChannelUpdateBitrate, onVoiceChannelUpdateName, onVoiceChannelUpdatePermissions, onVoiceChannelUpdatePosition, onVoiceChannelUpdateUserLimit
private java.lang.String stationURL
private com.sedmelluq.discord.lavaplayer.track.AudioTrack station
private java.lang.String voiceChannel
private final com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager playerManager
private eRadio(java.lang.String stationURL, java.lang.String voiceChannel)
stationURL
- Internet Radio Station URLvoiceChannel
- Discord VoiceChannel the bot will play in.public static void main(java.lang.String[] args)
args
- Given arguments from command line.private void joinVoice(net.dv8tion.jda.core.entities.Guild guild, net.dv8tion.jda.core.entities.TextChannel channel)
voiceChannel
specified by the bot.properties file if possible.guild
- The guild in which the voiceChannel
resides.channel
- Used to send a message saying the voiceChannel
was not found if it could not connect.public void onMessageReceived(net.dv8tion.jda.core.events.message.MessageReceivedEvent event)
onMessageReceived
in class net.dv8tion.jda.core.hooks.ListenerAdapter
event
- Carries the Message
which contains the command.private void loadAndPlay(net.dv8tion.jda.core.entities.TextChannel channel)
play(Guild, TextChannel, GuildMusicManager, AudioTrack)
.channel
- TextChannel
to send messages to.private GuildMusicManager getGuildAudioPlayer(net.dv8tion.jda.core.entities.Guild guild)
GuildMusicManager
to handle the music being played.guild
- The Guild
the manager pertains to.GuildMusicManager
private void play(net.dv8tion.jda.core.entities.Guild guild, net.dv8tion.jda.core.entities.TextChannel channel, GuildMusicManager musicManager, com.sedmelluq.discord.lavaplayer.track.AudioTrack radioStation)
VoiceChannel
specified by voiceChannel
, then queues the station
, and finally
sends a message confirming the start or continued play of the radio.guild
- Used to get the VoiceChannel
s available.channel
- TextChannel
to send a message confirming the start or continued play of the radio.musicManager
- The GuildMusicManager
used to queue the selectedradioStation
- The radio station to be queued.private void nowPlaying(net.dv8tion.jda.core.entities.TextChannel channel)
channel
- Used to get the TextChannel to send the message to.private void stopPlayer(net.dv8tion.jda.core.entities.TextChannel channel)
channel
- TextChannel
to send messages to.private void sendCommands(net.dv8tion.jda.core.entities.User user)
user
- The User
that entered the command. Used to get their PrivateChannel
.