Package dev.jacrispys.JavaBot.audio
Class GenerateGenrePlaylist
java.lang.Object
net.dv8tion.jda.api.hooks.ListenerAdapter
dev.jacrispys.JavaBot.audio.GenerateGenrePlaylist
- All Implemented Interfaces:
net.dv8tion.jda.api.hooks.EventListener
public class GenerateGenrePlaylist
extends net.dv8tion.jda.api.hooks.ListenerAdapter
Util class that uses
to generate playlists based off of
SpotifyApi
to generate playlists based off of
Recommendations
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected net.dv8tion.jda.api.entities.MessageEmbed
addGenre
(net.dv8tion.jda.api.entities.MessageEmbed embed, int position, net.dv8tion.jda.api.entities.User user) se.michaelthelin.spotify.model_objects.specification.Recommendations
generatePlaylistFromGenre
(String genres, int limit) Generates a playlist using spotify recommendations.se.michaelthelin.spotify.model_objects.specification.Recommendations
generatePlaylistFromGenre
(String genres, int limit, int popularity) Generates a playlist using spotify recommendations.void
onButtonInteraction
(@NotNull net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Adaptation ofAudioPlayerButtons
methods.void
onMessageDelete
(@NotNull net.dv8tion.jda.api.events.message.MessageDeleteEvent event) Resets all current GenreGenerator data when message is deleted.void
onMessageReactionAdd
(@NotNull net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent event) Manages reactions to the embed for genre selectionprotected void
updateMusicChannel
(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel channel) Manages important database entries to ensure song announcements are sentMethods inherited from class net.dv8tion.jda.api.hooks.ListenerAdapter
onApplicationCommandUpdatePrivileges, onApplicationUpdatePrivileges, onAutoModExecution, onAutoModRuleCreate, onAutoModRuleDelete, onAutoModRuleUpdate, onChannelCreate, onChannelDelete, onChannelUpdateAppliedTags, onChannelUpdateArchived, onChannelUpdateArchiveTimestamp, onChannelUpdateAutoArchiveDuration, onChannelUpdateBitrate, onChannelUpdateDefaultLayout, onChannelUpdateDefaultReaction, onChannelUpdateDefaultSortOrder, onChannelUpdateDefaultThreadSlowmode, onChannelUpdateFlags, onChannelUpdateInvitable, onChannelUpdateLocked, onChannelUpdateName, onChannelUpdateNSFW, onChannelUpdateParent, onChannelUpdatePosition, onChannelUpdateRegion, onChannelUpdateSlowmode, onChannelUpdateTopic, onChannelUpdateType, onChannelUpdateUserLimit, onChannelUpdateVoiceStatus, onCommandAutoCompleteInteraction, onEmojiAdded, onEmojiRemoved, onEmojiUpdateName, onEmojiUpdateRoles, onEntitySelectInteraction, onEvent, onException, onForumTagAdd, onForumTagRemove, onForumTagUpdateEmoji, onForumTagUpdateModerated, onForumTagUpdateName, onGatewayPing, onGenericAutoCompleteInteraction, onGenericAutoModRule, onGenericChannel, onGenericChannelUpdate, onGenericCommandInteraction, onGenericComponentInteractionCreate, onGenericContextInteraction, onGenericEmoji, onGenericEmojiUpdate, onGenericEvent, onGenericForumTag, onGenericForumTagUpdate, onGenericGuild, onGenericGuildInvite, onGenericGuildMember, onGenericGuildMemberUpdate, onGenericGuildSticker, onGenericGuildStickerUpdate, onGenericGuildUpdate, onGenericGuildVoice, onGenericInteractionCreate, onGenericMessage, onGenericMessageReaction, onGenericPermissionOverride, onGenericPrivilegeUpdate, onGenericRole, onGenericRoleUpdate, onGenericScheduledEventGateway, onGenericScheduledEventUpdate, onGenericScheduledEventUser, onGenericSelectMenuInteraction, onGenericSelfUpdate, onGenericSession, onGenericSessionEvent, onGenericStageInstance, onGenericStageInstanceUpdate, onGenericThread, onGenericThreadMember, onGenericUpdate, onGenericUser, onGenericUserPresence, onGenericUserUpdate, onGuildAuditLogEntryCreate, onGuildAvailable, onGuildBan, onGuildInviteCreate, onGuildInviteDelete, onGuildJoin, onGuildLeave, onGuildMemberJoin, onGuildMemberRemove, onGuildMemberRoleAdd, onGuildMemberRoleRemove, onGuildMemberUpdate, onGuildMemberUpdateAvatar, onGuildMemberUpdateBoostTime, onGuildMemberUpdateFlags, onGuildMemberUpdateNickname, onGuildMemberUpdatePending, onGuildMemberUpdateTimeOut, onGuildReady, onGuildStickerAdded, onGuildStickerRemoved, onGuildStickerUpdateAvailable, onGuildStickerUpdateDescription, onGuildStickerUpdateName, onGuildStickerUpdateTags, onGuildTimeout, onGuildUnavailable, onGuildUnban, onGuildUpdateAfkChannel, onGuildUpdateAfkTimeout, onGuildUpdateBanner, onGuildUpdateBoostCount, onGuildUpdateBoostTier, onGuildUpdateCommunityUpdatesChannel, onGuildUpdateDescription, onGuildUpdateExplicitContentLevel, onGuildUpdateFeatures, onGuildUpdateIcon, onGuildUpdateLocale, onGuildUpdateMaxMembers, onGuildUpdateMaxPresences, onGuildUpdateMFALevel, onGuildUpdateName, onGuildUpdateNotificationLevel, onGuildUpdateNSFWLevel, onGuildUpdateOwner, onGuildUpdateRulesChannel, onGuildUpdateSplash, onGuildUpdateSystemChannel, onGuildUpdateVanityCode, onGuildUpdateVerificationLevel, onGuildVoiceDeafen, onGuildVoiceGuildDeafen, onGuildVoiceGuildMute, onGuildVoiceMute, onGuildVoiceRequestToSpeak, onGuildVoiceSelfDeafen, onGuildVoiceSelfMute, onGuildVoiceStream, onGuildVoiceSuppress, onGuildVoiceUpdate, onGuildVoiceVideo, onHttpRequest, onMessageBulkDelete, onMessageContextInteraction, onMessageEmbed, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageReactionRemoveEmoji, onMessageReceived, onMessageUpdate, onModalInteraction, onPermissionOverrideCreate, onPermissionOverrideDelete, onPermissionOverrideUpdate, onRawGateway, onReady, onRoleCreate, onRoleDelete, onRoleUpdateColor, onRoleUpdateHoisted, onRoleUpdateIcon, onRoleUpdateMentionable, onRoleUpdateName, onRoleUpdatePermissions, onRoleUpdatePosition, onScheduledEventCreate, onScheduledEventDelete, onScheduledEventUpdateDescription, onScheduledEventUpdateEndTime, onScheduledEventUpdateImage, onScheduledEventUpdateLocation, onScheduledEventUpdateName, onScheduledEventUpdateStartTime, onScheduledEventUpdateStatus, onScheduledEventUserAdd, onScheduledEventUserRemove, onSelfUpdateAvatar, onSelfUpdateGlobalName, onSelfUpdateMFA, onSelfUpdateName, onSelfUpdateVerified, onSessionDisconnect, onSessionInvalidate, onSessionRecreate, onSessionResume, onShutdown, onSlashCommandInteraction, onStageInstanceCreate, onStageInstanceDelete, onStageInstanceUpdatePrivacyLevel, onStageInstanceUpdateTopic, onStatusChange, onStringSelectInteraction, onThreadHidden, onThreadMemberJoin, onThreadMemberLeave, onThreadRevealed, onUnavailableGuildJoined, onUnavailableGuildLeave, onUserActivityEnd, onUserActivityStart, onUserContextInteraction, onUserTyping, onUserUpdateActivities, onUserUpdateActivityOrder, onUserUpdateAvatar, onUserUpdateDiscriminator, onUserUpdateFlags, onUserUpdateGlobalName, onUserUpdateName, onUserUpdateOnlineStatus
-
Field Details
-
reactMessage
-
limit
-
popularity
-
genrePage
public static int genrePage -
chosenGenres
-
-
Constructor Details
-
GenerateGenrePlaylist
public GenerateGenrePlaylist()
-
-
Method Details
-
generatePlaylistFromGenre
public se.michaelthelin.spotify.model_objects.specification.Recommendations generatePlaylistFromGenre(String genres, int limit) throws IOException, org.apache.hc.core5.http.ParseException, se.michaelthelin.spotify.exceptions.SpotifyWebApiException Generates a playlist using spotify recommendations.- Parameters:
genres
- up to 5 genres to base the playlist off oflimit
- max amount of songs to be generated- Returns:
- recommendation data from spotify
- Throws:
IOException
- if the spotify request failsorg.apache.hc.core5.http.ParseException
- if the spotify request failsse.michaelthelin.spotify.exceptions.SpotifyWebApiException
- if the spotify request fails
-
generatePlaylistFromGenre
public se.michaelthelin.spotify.model_objects.specification.Recommendations generatePlaylistFromGenre(String genres, int limit, int popularity) throws IOException, org.apache.hc.core5.http.ParseException, se.michaelthelin.spotify.exceptions.SpotifyWebApiException Generates a playlist using spotify recommendations.- Parameters:
genres
- up to 5 genres to base the playlist off oflimit
- max amount of songs to be generatedpopularity
- number between 0-100 of the expected popularity of songs to be generated- Returns:
- recommendation data from spotify
- Throws:
IOException
- if the spotify request failsorg.apache.hc.core5.http.ParseException
- if the spotify request failsse.michaelthelin.spotify.exceptions.SpotifyWebApiException
- if the spotify request fails
-
onButtonInteraction
public void onButtonInteraction(@NotNull @NotNull net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Adaptation ofAudioPlayerButtons
methods.- Overrides:
onButtonInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- See Also:
-
onMessageReactionAdd
public void onMessageReactionAdd(@NotNull @NotNull net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent event) Manages reactions to the embed for genre selection- Overrides:
onMessageReactionAdd
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
-
addGenre
protected net.dv8tion.jda.api.entities.MessageEmbed addGenre(net.dv8tion.jda.api.entities.MessageEmbed embed, int position, net.dv8tion.jda.api.entities.User user) - Parameters:
embed
- edits an embed to update new genres toposition
- index in the list of genres to updateuser
- the user who interacted with the embed- Returns:
- buildable embed to reapply/edit the original
-
updateMusicChannel
protected void updateMusicChannel(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel channel) Manages important database entries to ensure song announcements are sent -
onMessageDelete
public void onMessageDelete(@NotNull @NotNull net.dv8tion.jda.api.events.message.MessageDeleteEvent event) Resets all current GenreGenerator data when message is deleted.- Overrides:
onMessageDelete
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
-