Class BlueskyPlatform

java.lang.Object
com.mcawful.social.bluesky.BlueskyPlatform
All Implemented Interfaces:
SocialPlatform

public final class BlueskyPlatform extends Object implements SocialPlatform
Bluesky, through the AT Protocol

Polls:

  • mentions: mention, reply and quote notifications
  • reposts: repost notifications, which also feed repost rewards
  • posts: the linked account's own posts, without replies, reposts and the posts the bot made
Notifications are never marked as read, so they stay unread in the Bluesky app.
Author:
mcawful
  • Method Details

    • instance

      public static BlueskyPlatform instance()
      Returns the instance
      Returns:
      the instance
    • getId

      public String getId()
      Description copied from interface: SocialPlatform
      Returns the id of the platform, used as its database table, its lang key prefix and its registry key
      Specified by:
      getId in interface SocialPlatform
      Returns:
      the lowercase id, such as bluesky
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: SocialPlatform
      Returns the name of the platform as shown to users
      Specified by:
      getDisplayName in interface SocialPlatform
      Returns:
      the display name, such as Bluesky
    • getModuleScript

      public String getModuleScript()
      Description copied from interface: SocialPlatform
      Returns the script of the chat module for this platform
      Specified by:
      getModuleScript in interface SocialPlatform
      Returns:
      the module script path, such as ./handlers/blueskyHandler.js
    • getDiscordModuleScript

      public String getDiscordModuleScript()
      Description copied from interface: SocialPlatform
      Returns the script of the Discord module for this platform
      Specified by:
      getDiscordModuleScript in interface SocialPlatform
      Returns:
      the module script path, such as ./discord/handlers/blueskyHandler.js
    • isConfigured

      public boolean isConfigured()
      Description copied from interface: SocialPlatform
      Indicates if credentials for the platform are present
      Specified by:
      isConfigured in interface SocialPlatform
      Returns:
      true if an account is linked
    • getAccountName

      public String getAccountName()
      Description copied from interface: SocialPlatform
      Returns the name of the linked account
      Specified by:
      getAccountName in interface SocialPlatform
      Returns:
      the account name, such as a handle; an empty string if no account is linked
    • getProfileUrl

      public String getProfileUrl()
      Description copied from interface: SocialPlatform
      Returns the web address of the linked account's profile
      Specified by:
      getProfileUrl in interface SocialPlatform
      Returns:
      the profile URL; an empty string if no account is linked
    • getPollTypes

      public List<SocialPollType> getPollTypes()
      Description copied from interface: SocialPlatform
      Returns the kinds of activity the platform can be polled for
      Specified by:
      getPollTypes in interface SocialPlatform
      Returns:
      the poll types
    • fetch

      public SocialFetchResult fetch(SocialPollType type, String watermark) throws Exception
      Description copied from interface: SocialPlatform
      Fetches the activity of one poll type that is newer than the watermark
      Specified by:
      fetch in interface SocialPlatform
      Parameters:
      type - the poll type
      watermark - the watermark returned by the previous fetch; null on the first fetch, which only needs to return a watermark
      Returns:
      the new items, newest first, and the new watermark
      Throws:
      Exception - if the activity could not be fetched
    • createPost

      public SocialPostResult createPost(String text, SocialLinkCard card, boolean truncate)
      Description copied from interface: SocialPlatform
      Creates a post on the linked account
      Specified by:
      createPost in interface SocialPlatform
      Parameters:
      text - the text of the post
      card - a link card to attach; null for none
      truncate - if true, text that is too long is shortened; otherwise the post is refused
      Returns:
      the result
    • resolveAccountId

      public String resolveAccountId(String accountName)
      Description copied from interface: SocialPlatform
      Looks up the permanent id of an account
      Specified by:
      resolveAccountId in interface SocialPlatform
      Parameters:
      accountName - the account name, such as a handle
      Returns:
      the account id; null if the account was not found
    • link

      public SocialPostResult link(String account, String secret, String service)
      Description copied from interface: SocialPlatform
      Checks the credentials and, if they work, saves them to the bot properties
      Specified by:
      link in interface SocialPlatform
      Parameters:
      account - the account name
      secret - the password or token
      service - the address of the service to sign in to; empty for the default
      Returns:
      the result; on success, SocialPostResult.url() is the profile URL
    • unlink

      public void unlink()
      Description copied from interface: SocialPlatform
      Removes the saved credentials and ends the session
      Specified by:
      unlink in interface SocialPlatform
    • shutdown

      public void shutdown()
      Description copied from interface: SocialPlatform
      Releases resources on shutdown
      Specified by:
      shutdown in interface SocialPlatform