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 SpotifyApi
to generate playlists based off of Recommendations
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Map<net.dv8tion.jda.api.entities.User,List<Integer>>
     
    static int
     
    static Map<net.dv8tion.jda.api.entities.User,Integer>
     
    static Map<net.dv8tion.jda.api.entities.User,Integer>
     
    static Map<net.dv8tion.jda.api.entities.User,Long>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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 of AudioPlayerButtons 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 selection
    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

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • reactMessage

      public static Map<net.dv8tion.jda.api.entities.User,Long> reactMessage
    • limit

      public static Map<net.dv8tion.jda.api.entities.User,Integer> limit
    • popularity

      public static Map<net.dv8tion.jda.api.entities.User,Integer> popularity
    • genrePage

      public static int genrePage
    • chosenGenres

      public static Map<net.dv8tion.jda.api.entities.User,List<Integer>> 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 of
      limit - max amount of songs to be generated
      Returns:
      recommendation data from spotify
      Throws:
      IOException - if the spotify request fails
      org.apache.hc.core5.http.ParseException - if the spotify request fails
      se.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 of
      limit - max amount of songs to be generated
      popularity - number between 0-100 of the expected popularity of songs to be generated
      Returns:
      recommendation data from spotify
      Throws:
      IOException - if the spotify request fails
      org.apache.hc.core5.http.ParseException - if the spotify request fails
      se.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 of AudioPlayerButtons methods.
      Overrides:
      onButtonInteraction in class net.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 class net.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 to
      position - index in the list of genres to update
      user - 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 class net.dv8tion.jda.api.hooks.ListenerAdapter