Package com.mcawful.social.bluesky
Class BlueskyPlatform
java.lang.Object
com.mcawful.social.bluesky.BlueskyPlatform
- All Implemented Interfaces:
SocialPlatform
Bluesky, through the AT Protocol
Polls:
mentions: mention, reply and quote notificationsreposts: repost notifications, which also feed repost rewardsposts: the linked account's own posts, without replies, reposts and the posts the bot made
- Author:
- mcawful
-
Method Summary
Modifier and TypeMethodDescriptioncreatePost(String text, SocialLinkCard card, boolean truncate) Creates a post on the linked accountfetch(SocialPollType type, String watermark) Fetches the activity of one poll type that is newer than the watermarkReturns the name of the linked accountReturns the script of the Discord module for this platformReturns the name of the platform as shown to usersgetId()Returns the id of the platform, used as its database table, its lang key prefix and its registry keyReturns the script of the chat module for this platformReturns the kinds of activity the platform can be polled forReturns the web address of the linked account's profilestatic BlueskyPlatforminstance()Returns the instancebooleanIndicates if credentials for the platform are presentChecks the credentials and, if they work, saves them to the bot propertiesresolveAccountId(String accountName) Looks up the permanent id of an accountvoidshutdown()Releases resources on shutdownvoidunlink()Removes the saved credentials and ends the session
-
Method Details
-
instance
Returns the instance- Returns:
- the instance
-
getId
Description copied from interface:SocialPlatformReturns the id of the platform, used as its database table, its lang key prefix and its registry key- Specified by:
getIdin interfaceSocialPlatform- Returns:
- the lowercase id, such as
bluesky
-
getDisplayName
Description copied from interface:SocialPlatformReturns the name of the platform as shown to users- Specified by:
getDisplayNamein interfaceSocialPlatform- Returns:
- the display name, such as
Bluesky
-
getModuleScript
Description copied from interface:SocialPlatformReturns the script of the chat module for this platform- Specified by:
getModuleScriptin interfaceSocialPlatform- Returns:
- the module script path, such as
./handlers/blueskyHandler.js
-
getDiscordModuleScript
Description copied from interface:SocialPlatformReturns the script of the Discord module for this platform- Specified by:
getDiscordModuleScriptin interfaceSocialPlatform- Returns:
- the module script path, such as
./discord/handlers/blueskyHandler.js
-
isConfigured
public boolean isConfigured()Description copied from interface:SocialPlatformIndicates if credentials for the platform are present- Specified by:
isConfiguredin interfaceSocialPlatform- Returns:
trueif an account is linked
-
getAccountName
Description copied from interface:SocialPlatformReturns the name of the linked account- Specified by:
getAccountNamein interfaceSocialPlatform- Returns:
- the account name, such as a handle; an empty string if no account is linked
-
getProfileUrl
Description copied from interface:SocialPlatformReturns the web address of the linked account's profile- Specified by:
getProfileUrlin interfaceSocialPlatform- Returns:
- the profile URL; an empty string if no account is linked
-
getPollTypes
Description copied from interface:SocialPlatformReturns the kinds of activity the platform can be polled for- Specified by:
getPollTypesin interfaceSocialPlatform- Returns:
- the poll types
-
fetch
Description copied from interface:SocialPlatformFetches the activity of one poll type that is newer than the watermark- Specified by:
fetchin interfaceSocialPlatform- Parameters:
type- the poll typewatermark- the watermark returned by the previous fetch;nullon 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
Description copied from interface:SocialPlatformCreates a post on the linked account- Specified by:
createPostin interfaceSocialPlatform- Parameters:
text- the text of the postcard- a link card to attach;nullfor nonetruncate- iftrue, text that is too long is shortened; otherwise the post is refused- Returns:
- the result
-
resolveAccountId
Description copied from interface:SocialPlatformLooks up the permanent id of an account- Specified by:
resolveAccountIdin interfaceSocialPlatform- Parameters:
accountName- the account name, such as a handle- Returns:
- the account id;
nullif the account was not found
-
link
Description copied from interface:SocialPlatformChecks the credentials and, if they work, saves them to the bot properties- Specified by:
linkin interfaceSocialPlatform- Parameters:
account- the account namesecret- the password or tokenservice- 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:SocialPlatformRemoves the saved credentials and ends the session- Specified by:
unlinkin interfaceSocialPlatform
-
shutdown
public void shutdown()Description copied from interface:SocialPlatformReleases resources on shutdown- Specified by:
shutdownin interfaceSocialPlatform
-