Class: UserData

UserData()

Represents background and scoring-related data about the current Fedialgo user. Used as a central source of user context for scoring, filtering, and personalization. This class aggregates and manages user-related data such as favourited accounts, followed tags, muted accounts, languages posted in, and server-side filters. It provides methods to build user data from the Mastodon API or from raw API data, and supports updating, counting, and filtering operations for use in scoring and filtering algorithms.

Constructor

new UserData()

Properties:
Name Type Description
blockedDomains Set.<string> Set of domains the user has blocked.
favouriteAccounts BooleanFilterOptionList Accounts the user has favourited, retooted, or replied to.
favouritedTags TagList List of tags the user has favourited.
followedAccounts StringNumberDict Dictionary of accounts the user follows, keyed by account name.
followedTags TagList List of tags the user follows.
languagesPostedIn ObjList List of languages the user has posted in, with usage counts.
mutedAccounts Record.<string, Account> Dictionary of accounts the user has muted or blocked, keyed by Account["webfingerURI"].
mutedKeywordsRegex RegExp Cached regex for muted keywords, built from server-side filters.
participatedTags TagList List of tags the user has participated in.
preferredLanguage string The user's preferred language (ISO code).
serverSideFilters Array.<mastodon.v2.Filter> Array of server-side filters set by the user.

Methods

(async, static) getMutedKeywords() → {Promise.<Array.<string>>}

Get an array of keywords the user has muted on the server side
Returns:
An array of muted keywords.
Type
Promise.<Array.<string>>

(async, static) getMutedKeywordsRegex() → {Promise.<RegExp>}

Build a regex that matches any of the user's muted keywords.
Returns:
A RegExp that matches any of the user's muted keywords.
Type
Promise.<RegExp>