Class AudioActivity

java.lang.Object
dev.jacrispys.JavaBot.api.analytics.objects.AudioActivity

public class AudioActivity extends Object
API component that allows access to the 'AudioActivity' database table
See Also:
  • AudioActivities
  • Method Details

    • getAudioActivity

      public static AudioActivity getAudioActivity(AudioUser user) throws ExecutionException, InterruptedException
      Instance manager for audio activity objects.
      Parameters:
      user - to obtain data from
      Returns:
      instance of the current class if it exists, or creates a new one.
      Throws:
      ExecutionException - if an async connection fails
      InterruptedException - if the thread gets blocked
      See Also:
    • getGuildStat

      protected Object getGuildStat(long guildId, @NotNull @NotNull dev.jacrispys.JavaBot.api.analytics.objects.AudioActivities activity) throws SQLException
      Obtains a statistic from the 'audio_activity' table with AudioActivities as a query parameter
      Parameters:
      guildId - to filter by in the database
      activity - - the type of data to be retrieved
      Returns:
      a POJO from the MySQL ResultSet
      Throws:
      SQLException - if a database exception occurs
    • incrementStat

      public void incrementStat(long guildId, @NotNull @NotNull dev.jacrispys.JavaBot.api.analytics.objects.AudioActivities activity)
      Increments a given stat in the 'guild_general_stats' database table
      Parameters:
      guildId - for correct row to update
      activity - - type of activity to increment stat for
      See Also:
    • incrementStat

      public void incrementStat(long guildId, int increment, dev.jacrispys.JavaBot.api.analytics.objects.AudioActivities activity)
      Increments a given stat in the 'guild_general_stats' database table
      Parameters:
      guildId - for correct row to update
      activity - - type of activity to increment stat for
      increment - - int value to increase the dataset by
      See Also:
    • getSongQueues

      public long getSongQueues(long guildId) throws SQLException
      Specified internal call to getGuildStat(long, AudioActivities)
      Parameters:
      guildId - to update the data in
      Returns:
      number of song queues from given guild
      Throws:
      SQLException - if a database error occurs
    • getPlaylistQueues

      public long getPlaylistQueues(long guildId) throws SQLException
      Specified internal call to getGuildStat(long, AudioActivities)
      Parameters:
      guildId - to update the data in
      Returns:
      number of playlist queues from given guild
      Throws:
      SQLException - if a database error occurs
    • getListenTimeMillis

      public long getListenTimeMillis(long guildId) throws SQLException
      Specified internal call to getGuildStat(long, AudioActivities)
      Parameters:
      guildId - to update the data in
      Returns:
      number of milliseconds listened from given guild
      Throws:
      SQLException - if a database error occurs
    • getSkipOthers

      public long getSkipOthers(long guildId) throws SQLException
      Specified internal call to getGuildStat(long, AudioActivities)
      Parameters:
      guildId - to update the data in
      Returns:
      number of times tracks have been skipped by users who didn't queue them
      Throws:
      SQLException - if a database error occurs