Class SocialPlatformRegistry

java.lang.Object
com.mcawful.social.SocialPlatformRegistry
All Implemented Interfaces:
Listener

public final class SocialPlatformRegistry extends Object implements Listener
The social media platforms known to the bot

Exposed to scripts as $.socialPlatforms. Also answers the panel's requests to link and unlink an account, sent with socket.wsEvent(id, 'SocialPlatforms.java', null, ['link', platformId, account, secret, service], callback, true) or ['unlink', platformId]. Only the panel's config users may send them (see PanelUserHandler).

Author:
mcawful
  • Field Details

    • PANEL_SCRIPT

      public static final String PANEL_SCRIPT
      The script name the panel sends link and unlink requests to
      See Also:
  • Method Details

    • instance

      public static SocialPlatformRegistry instance()
      Returns the instance, creating it and its platforms on first use
      Returns:
      the instance
    • get

      public SocialPlatform get(String id)
      Returns a platform by id
      Parameters:
      id - the platform id, such as bluesky
      Returns:
      the platform; null if there is none with that id
    • getPlatforms

      public List<SocialPlatform> getPlatforms()
      Returns every platform
      Returns:
      the platforms
    • onWebPanelSocketUpdateEvent

      public void onWebPanelSocketUpdateEvent(WebPanelSocketUpdateEvent event)
      Handles the panel's link and unlink requests
      Parameters:
      event - the event
    • shutdown

      public void shutdown()
      Releases the resources of every platform