@crowbartools/firebot-types 5.67.0-alpha26 → 5.67.0-alpha27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +674 -674
  2. package/backend/chat/active-user-handler.d.ts +7 -1
  3. package/backend/chat/frontend-chat-manager.d.ts +36 -0
  4. package/backend/common/connection-manager.d.ts +40 -0
  5. package/backend/common/profile-manager.d.ts +3 -0
  6. package/backend/core/update-manager.d.ts +16 -0
  7. package/backend/currency/currency-manager.d.ts +1 -0
  8. package/backend/events/activity-feed-manager.d.ts +8 -1
  9. package/backend/events/event-manager.d.ts +1 -1
  10. package/backend/overlay-widgets/builtin-types/index.d.ts +2 -2
  11. package/backend/plugins/plugin-api/namespaces/currency.d.ts +2 -0
  12. package/backend/plugins/plugin-api/namespaces/viewers.d.ts +2 -0
  13. package/backend/plugins/plugin-manager.d.ts +19 -7
  14. package/backend/roles/twitch-roles-manager.d.ts +4 -0
  15. package/backend/streaming-platforms/twitch/api/eventsub/eventsub-chat-helpers.d.ts +1 -0
  16. package/backend/streaming-platforms/twitch/api/resource/moderation.d.ts +1 -1
  17. package/backend/streaming-platforms/twitch/events/bits.d.ts +1 -1
  18. package/backend/ui-extensions/ui-extension-manager.d.ts +4 -2
  19. package/backend/utils/index.d.ts +1 -0
  20. package/backend/utils/versions.d.ts +9 -0
  21. package/backend/viewers/viewer-database.d.ts +3 -1
  22. package/backend/viewers/viewer-metadata-manager.d.ts +3 -0
  23. package/backend/viewers/viewer-online-status-manager.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/shared/compare-versions.d.ts +21 -0
  26. package/types/chat.d.ts +76 -0
  27. package/types/integrations.d.ts +1 -2
  28. package/types/plugin-api.d.ts +84 -1
  29. package/types/plugins.d.ts +28 -30
  30. package/types/ui/modal-factory.d.ts +9 -0
  31. package/types/ui-extensions.d.ts +3 -1
  32. package/types/viewers.d.ts +9 -0
  33. package/backend/chat/frontend-chat-helpers.d.ts +0 -14
@@ -27,12 +27,17 @@ type Events = {
27
27
  "user:offline": (userId: string) => void;
28
28
  };
29
29
  declare class ActiveUserHandler extends TypedEmitter<Events> {
30
- private logger;
30
+ private _logger;
31
+ private _cachedFrontendViewers;
31
32
  private readonly DEFAULT_ACTIVE_TIMEOUT;
32
33
  private readonly ONLINE_TIMEOUT;
33
34
  private _onlineUsers;
34
35
  private _activeUsers;
35
36
  constructor();
37
+ private sendViewerUpdateToFrontend;
38
+ private updateViewerActiveStatus;
39
+ updateOnlineViewerRoles(userId: string, roles: string[]): void;
40
+ private setUserOffline;
36
41
  /**
37
42
  * Check if user is active
38
43
  * @param usernameOrId Twitch username or user ID
@@ -50,6 +55,7 @@ declare class ActiveUserHandler extends TypedEmitter<Events> {
50
55
  addActiveUser(chatUser: ChatUser, includeInOnline?: boolean, forceActive?: boolean): Promise<void>;
51
56
  removeActiveUser(usernameOrId: string | number): void;
52
57
  clearAllActiveUsers(): void;
58
+ triggerUiRefresh(): void;
53
59
  }
54
60
  declare const handler: ActiveUserHandler;
55
61
  export { handler as ActiveUserHandler };
@@ -0,0 +1,36 @@
1
+ import type { DashboardChatFeedPowerUpData, DashboardChatFeedRewardData, FirebotChatMessage } from "../../types";
2
+ declare class FrontendChatManager {
3
+ private _logger;
4
+ private _chatFeedCache;
5
+ private _chatFeedCacheLimit;
6
+ private _pendingOverlayMessageCache;
7
+ constructor();
8
+ private addNewChatFeedItem;
9
+ private sendUpdatedFeedItemToDashboard;
10
+ sendAlertToDashboard(message: string, icon?: string): void;
11
+ sendRewardRedemptionToDashboard(redemption: DashboardChatFeedRewardData): void;
12
+ sendPowerUpRedemptionToDashboard(redemption: DashboardChatFeedPowerUpData): void;
13
+ private sendChatMessageToDashboard;
14
+ private sendChatMessageToChatWidget;
15
+ sendChatMessageToFrontend(chatMessage: FirebotChatMessage): void;
16
+ private deleteChatMessageFromDashboard;
17
+ private deleteChatMessageFromChatWidget;
18
+ deleteChatMessageFromFrontend(messageId: string, animate?: boolean): void;
19
+ private deleteUserMessagesFromDashboard;
20
+ deleteUserMessagesFromFrontend(username: string): void;
21
+ private clearDashboardChatFeed;
22
+ clearChatFeed(moderatorUsername: string): void;
23
+ private expireAutomodForChatMessage;
24
+ updateChatMessageAutomodStatus(messageId: string, newStatus: FirebotChatMessage["autoModStatus"], resolverName: string): void;
25
+ setChatMessageAutomodError(messageId: string, likelyExpired: boolean): void;
26
+ addCustomHighlightToDashboardChatMessage(highlightData: {
27
+ messageId: string;
28
+ customHighlightColor: string;
29
+ customBannerIcon: string;
30
+ customBannerText: string;
31
+ }): void;
32
+ hideChatMessageFromDashboard(messageId: string): void;
33
+ triggerUiRefresh(): void;
34
+ }
35
+ declare const manager: FrontendChatManager;
36
+ export { manager as FrontendChatManager };
@@ -0,0 +1,40 @@
1
+ import { TypedEmitter } from "tiny-typed-emitter";
2
+ import type { HelixStream } from "@twurple/api";
3
+ import { ConnectionState } from "../../shared/connection-constants";
4
+ type ServiceConnectionEventData = {
5
+ serviceId: string;
6
+ connectionState: ConnectionState;
7
+ };
8
+ type ServiceConnectionUpdateRequest = {
9
+ id: string;
10
+ action: boolean | "toggle";
11
+ };
12
+ type ConnectionManagerEvents = {
13
+ "streamerOnlineChange": (isOnline: boolean, stream: HelixStream) => void;
14
+ "service-connection-update": (event: ServiceConnectionEventData) => void;
15
+ };
16
+ declare class ConnectionManager extends TypedEmitter<ConnectionManagerEvents> {
17
+ private _logger;
18
+ private _currentStream;
19
+ private _onlineCheckIntervalId;
20
+ private _serviceConnectionStates;
21
+ private _connectionUpdateInProgress;
22
+ private _currentlyWaitingService;
23
+ constructor();
24
+ private onServiceConnectionUpdated;
25
+ private checkOnline;
26
+ startOnlineCheckInterval(): void;
27
+ get streamerIsOnline(): boolean;
28
+ get currentStream(): HelixStream | null;
29
+ get chatIsConnected(): boolean;
30
+ serviceIsConnected(serviceId: string): boolean;
31
+ private connectSidebarControlledServices;
32
+ private disconnectSidebarControlledServices;
33
+ updateChatConnection(shouldConnect: boolean): boolean;
34
+ updateIntegrationConnection(integrationId: string, shouldConnect: boolean): boolean;
35
+ updateServiceConnection(serviceId: string, shouldConnect: boolean): boolean;
36
+ updateConnectionForServices(services: ServiceConnectionUpdateRequest[]): Promise<void>;
37
+ triggerUiRefresh(): void;
38
+ }
39
+ declare const manager: ConnectionManager;
40
+ export { manager as ConnectionManager };
@@ -17,6 +17,9 @@ declare class ProfileManager {
17
17
  deletePathInProfile(filePath: string): void;
18
18
  getNewProfileName: () => string;
19
19
  hasProfileRename: () => boolean;
20
+ private getAccountInfo;
21
+ private getProfileDataForFrontend;
22
+ triggerUiRefresh(): void;
20
23
  }
21
24
  declare const manager: ProfileManager;
22
25
  export { manager as ProfileManager };
@@ -0,0 +1,16 @@
1
+ declare class UpdateManager {
2
+ private _logger;
3
+ private _octokit;
4
+ private _isCheckingForUpdates;
5
+ private _hasCheckedForUpdates;
6
+ private _updateDownloaded;
7
+ private _updateData;
8
+ constructor();
9
+ private shouldAutoUpdate;
10
+ private checkForUpdate;
11
+ private downloadUpdate;
12
+ private installUpdate;
13
+ triggerUiRefresh(): void;
14
+ }
15
+ declare const manager: UpdateManager;
16
+ export { manager as UpdateManager };
@@ -24,6 +24,7 @@ declare class CurrencyManager {
24
24
  adjustCurrencyForAllViewers(currencyId: string, value: string | number, ignoreDisable?: boolean, adjustType?: string): Promise<void>;
25
25
  addCurrencyToAllViewers(currencyId: string, value: number): Promise<void>;
26
26
  getViewerCurrencyAmount(username: string, currencyId: string): Promise<number>;
27
+ getViewerCurrencyAmountByUserId(userId: string, currencyId: string): Promise<number>;
27
28
  getViewerCurrencies(usernameOrId: string, isUsername?: boolean): Promise<Record<string, number>>;
28
29
  getViewerCurrencyRank(currencyId: string, usernameOrId: string, isUsername?: boolean): Promise<number>;
29
30
  getTopCurrencyPosition(currencyId: string, position?: number): Promise<FirebotViewer>;
@@ -1,9 +1,11 @@
1
1
  import type { EventDefinition } from "../../types";
2
2
  declare class ActivityFeedManager {
3
+ private _previousActivity;
4
+ private _logger;
3
5
  isUSLocale: boolean;
4
6
  timeFormat: string;
5
- private _previousActivity;
6
7
  constructor();
8
+ private formatActivityForFrontend;
7
9
  handleTriggeredEvent(source: {
8
10
  id: string;
9
11
  name: string;
@@ -13,6 +15,11 @@ declare class ActivityFeedManager {
13
15
  }): void;
14
16
  retriggerLastActivity(): void;
15
17
  private retriggerActivity;
18
+ private toggleActivityAcknowledged;
19
+ updateAcknowledgedForAll(acknowledged: boolean): void;
20
+ private toggleAcknowledgedForAll;
21
+ private clearAllActivities;
22
+ triggerUiRefresh(): void;
16
23
  }
17
24
  declare const manager: ActivityFeedManager;
18
25
  export { manager as ActivityFeedManager };
@@ -20,7 +20,7 @@ declare class EventManager extends TypedEmitter<{
20
20
  getEventById(sourceId: string, eventId: string): EventDefinition;
21
21
  getAllEventSources(): RegisteredEventSource[];
22
22
  getAllEvents(): EventDefinition[];
23
- triggerEvent(eventSourceId: string, eventId: string, meta: Record<string, unknown>, isManual?: boolean, isRetrigger?: boolean, isSimulation?: boolean): Promise<void>;
23
+ triggerEvent(eventSourceId: string, eventId: string, meta?: Record<string, unknown>, isManual?: boolean, isRetrigger?: boolean, isSimulation?: boolean): Promise<void>;
24
24
  }
25
25
  declare const manager: EventManager;
26
26
  export { manager as EventManager };
@@ -1,4 +1,4 @@
1
- declare const _default: (import("../../../types").OverlayWidgetType<{
1
+ declare const _default: (import("../../../types").OverlayWidgetType<import("./chat/chat").ChatWidgetSettings, import("./chat/chat").ChatWidgetState> | import("../../../types").OverlayWidgetType<import("./chat/chat-advanced").AdvancedChatWidgetSettings, import("./chat/chat").ChatWidgetState> | import("../../../types").OverlayWidgetType<{
2
2
  title?: string;
3
3
  titleFontOptions?: import("../../../types").FontOptions;
4
4
  barColor: string;
@@ -44,5 +44,5 @@ declare const _default: (import("../../../types").OverlayWidgetType<{
44
44
  imageType: "local" | "url";
45
45
  filepath: string;
46
46
  url: string;
47
- }, {}> | import("../../../types").OverlayWidgetType<import("./chat/chat").ChatWidgetSettings, import("./chat/chat").ChatWidgetState> | import("../../../types").OverlayWidgetType<import("./chat/chat-advanced").AdvancedChatWidgetSettings, import("./chat/chat").ChatWidgetState> | import("../../../types").OverlayWidgetType<import("./twitch-poll/twitch-poll").PollSettings, import("./twitch-poll/twitch-poll").PollState> | import("../../../types").OverlayWidgetType<import("./twitch-prediction/twitch-prediction").PredictionSettings, import("./twitch-prediction/twitch-prediction").PredictionState>)[];
47
+ }, {}> | import("../../../types").OverlayWidgetType<import("./twitch-poll/twitch-poll").PollSettings, import("./twitch-poll/twitch-poll").PollState> | import("../../../types").OverlayWidgetType<import("./twitch-prediction/twitch-prediction").PredictionSettings, import("./twitch-prediction/twitch-prediction").PredictionState>)[];
48
48
  export default _default;
@@ -0,0 +1,2 @@
1
+ import type { PluginCurrencyApi } from "../../../../types/plugin-api";
2
+ export declare const createCurrencyApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginCurrencyApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginViewersApi } from "../../../../types/plugin-api";
2
+ export declare const createViewersApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginViewersApi>;
@@ -9,15 +9,26 @@ type GetPluginDetailsResult = {
9
9
  success: false;
10
10
  error: string;
11
11
  };
12
+ type PluginInstallResult = {
13
+ success: true;
14
+ installedPlugin: InstalledPlugin;
15
+ } | {
16
+ success: false;
17
+ error: string;
18
+ };
12
19
  declare class PluginManager {
20
+ private _logger;
13
21
  private startingPlugins;
14
22
  private activePlugins;
23
+ private updateCheckInterval;
24
+ private pendingUpdates;
15
25
  private pendingApiInstances;
16
26
  private requireInterceptorInstalled;
17
27
  private pluginExecutors;
18
28
  private legacyEffectScriptExecutor;
19
29
  constructor();
20
30
  migrateLegacyStartUpScriptsToPlugins(): Promise<void>;
31
+ triggerUiRefresh(): Promise<void>;
21
32
  startPlugin(pluginConfig: InstalledPluginConfig, installing?: boolean): Promise<void>;
22
33
  private doStartPlugin;
23
34
  startPlugins(): Promise<void>;
@@ -32,7 +43,7 @@ declare class PluginManager {
32
43
  * Handle a config change. Starts/stops as needed, and on a still-enabled plugin
33
44
  * either re-loads (if file may have changed) or invokes onParameterUpdate.
34
45
  */
35
- reloadPluginConfig(pluginConfig: InstalledPluginConfig, isNewInstall?: boolean): Promise<void>;
46
+ reloadPluginConfig(pluginConfig: InstalledPluginConfig): Promise<void>;
36
47
  setPluginEnabled(pluginId: string, enabled: boolean): Promise<void>;
37
48
  getInstalledPlugins(): Promise<InstalledPlugin[]>;
38
49
  private doGetPluginDetailsByFileName;
@@ -45,16 +56,11 @@ declare class PluginManager {
45
56
  * Validates a file at any path on disk and copies it into the scripts folder.
46
57
  * Does NOT persist an InstalledPluginConfig — caller does that on save.
47
58
  */
48
- installPluginFromPath(sourcePath: string, overwrite?: boolean): Promise<GetPluginDetailsResult | {
59
+ installPluginFromPath(sourcePath: string, overwrite?: boolean): Promise<PluginInstallResult | {
49
60
  success: false;
50
61
  error: string;
51
62
  conflict?: boolean;
52
63
  }>;
53
- /**
54
- * Delete a copied plugin file that the user cancelled installing, but only
55
- * when no config currently references it.
56
- */
57
- cancelInstall(fileName: string): Promise<void>;
58
64
  /**
59
65
  * Called by PluginConfigManager when a config is deleted, so we can stop the
60
66
  * plugin.
@@ -94,6 +100,12 @@ declare class PluginManager {
94
100
  */
95
101
  private loadPluginIsolated;
96
102
  private isValidPlugin;
103
+ private searchForCommunityPlugins;
104
+ private downloadAndSaveCommunityPlugin;
105
+ private installCommunityPlugin;
106
+ private updateCommunityPlugin;
107
+ startCommunityPluginUpdateCheck(): void;
108
+ private checkForCommunityPluginUpdates;
97
109
  }
98
110
  declare const pluginManager: PluginManager;
99
111
  export { pluginManager as PluginManager };
@@ -13,6 +13,7 @@ declare class TwitchRolesManager extends TypedEmitter<Events> {
13
13
  private _vips;
14
14
  private _moderators;
15
15
  private _subscribers;
16
+ private _subscribersLastLoadedAt;
16
17
  constructor();
17
18
  setupListeners(): void;
18
19
  loadVips(): Promise<void>;
@@ -24,7 +25,10 @@ declare class TwitchRolesManager extends TypedEmitter<Events> {
24
25
  addModeratorToModeratorsList(viewer: BasicViewer): void;
25
26
  removeModeratorFromModeratorsList(userId: string): void;
26
27
  loadSubscribers(): Promise<void>;
28
+ private getMinutesSinceSubscribersLoaded;
27
29
  getSubscribers(): Subscriber[];
30
+ addSubscriberToSubscribersList(userId: string, username: string, displayName: string, tier: string): void;
31
+ removeSubscriberFromSubscribersList(userId: string): void;
28
32
  private getRoleForSubTier;
29
33
  }
30
34
  declare const twitchRolesManager: TwitchRolesManager;
@@ -38,6 +38,7 @@ declare class TwitchEventSubChatHelpers {
38
38
  cacheThirdPartyEmotes(): Promise<void>;
39
39
  cacheCheermotes(): Promise<void>;
40
40
  cacheChatAssets(): Promise<void>;
41
+ private sendAllEmotesToFrontend;
41
42
  private _mapCachedEmotesForFrontend;
42
43
  private getEmoteUrl;
43
44
  private accountTaggedInText;
@@ -1,5 +1,5 @@
1
1
  import { type HelixBan, type HelixModerator, type UserIdResolvable } from "@twurple/api";
2
- import type { BasicViewer } from '../../../../../types/viewers';
2
+ import type { BasicViewer } from '../../../../../types';
3
3
  import { ApiResourceBase } from './api-resource-base';
4
4
  import type { TwitchApi } from "../";
5
5
  type ModerationEvents = {
@@ -1,4 +1,4 @@
1
- import { EventSubChannelBitsUseMessagePart } from "../api/twurple-private-types";
1
+ import type { EventSubChannelBitsUseMessagePart } from "../api/twurple-private-types";
2
2
  export declare function triggerCheer(username: string, userId: string, userDisplayName: string, bits: number, totalBits: number, cheerMessage: string, cheerMessageParts: EventSubChannelBitsUseMessagePart[]): void;
3
3
  export declare function triggerBitsBadgeUnlock(username: string, userId: string, userDisplayName: string, message: string, badgeTier: number): void;
4
4
  export declare function triggerPowerupMessageEffect(username: string, userId: string, userDisplayName: string, bits: number, totalBits: number, cheerMessage: string): void;
@@ -2,10 +2,12 @@ import type { UIExtension } from "../../types";
2
2
  declare class UIExtensionManager {
3
3
  private _logger;
4
4
  private _extensions;
5
+ private _pendingRemovals;
6
+ private _pendingRegistrations;
5
7
  private uiReady;
6
- constructor();
7
8
  registerUIExtension(extension: UIExtension, pluginId?: string): boolean;
8
- private setUIReadyForExtensions;
9
+ queueUIExtensionRemoval(extensionId: string): void;
10
+ setUIReadyForExtensions(): void;
9
11
  private prepareExtensionForFrontend;
10
12
  private prepareFunc;
11
13
  }
@@ -14,3 +14,4 @@ export { pick } from "./pick";
14
14
  export { stringify } from "./stringify";
15
15
  export { getEventIdFromTriggerData } from "./trigger-data";
16
16
  export { getUrlRegex } from "./url";
17
+ export { meetsFirebotVersionRequirement } from "./versions";
@@ -0,0 +1,9 @@
1
+ import type { ManifestFirebotVersion } from "../../types";
2
+ /**
3
+ * Checks whether a given Firebot version meets the provided minimum and/or maximum version spec
4
+ * @param current Current Firebot version
5
+ * @param min Minimum required Firebot version
6
+ * @param max Maximum compatible Firebot version
7
+ * @returns `true` if the supplied current version is within the constraints, or `false` if not
8
+ */
9
+ export declare const meetsFirebotVersionRequirement: (current: ManifestFirebotVersion, min?: ManifestFirebotVersion, max?: ManifestFirebotVersion) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { TypedEmitter } from "tiny-typed-emitter";
2
2
  import Datastore from "@seald-io/nedb";
3
- import type { BasicViewer, FirebotViewer, NewFirebotViewer, Rank, RankLadder } from "../../types";
3
+ import type { BasicViewer, FirebotViewer, FrontendViewer, NewFirebotViewer, Rank, RankLadder } from "../../types";
4
4
  interface ViewerDbChangePacket {
5
5
  userId: string;
6
6
  field: string;
@@ -40,6 +40,7 @@ interface UserDetails {
40
40
  twitchData: Record<string, unknown>;
41
41
  streamerFollowsUser: boolean;
42
42
  userFollowsStreamer: boolean;
43
+ pronouns: string;
43
44
  }
44
45
  declare class ViewerDatabase extends TypedEmitter<{
45
46
  "viewer-database-loaded": () => void;
@@ -47,6 +48,7 @@ declare class ViewerDatabase extends TypedEmitter<{
47
48
  userId: string;
48
49
  url: string;
49
50
  }) => void;
51
+ "frontend-viewer-updated": (viewer: FrontendViewer) => void;
50
52
  }> {
51
53
  private logger;
52
54
  private _db;
@@ -9,10 +9,13 @@ declare class ViewerMetadataManager extends TypedEmitter<Events> {
9
9
  private logger;
10
10
  constructor();
11
11
  getViewerMetadata(username: string, key: string, propertyPath: string): Promise<unknown>;
12
+ getViewerMetadataByUserId(userId: string, key: string, propertyPath?: string): Promise<unknown>;
12
13
  getTopMetadataPosition(metadataKey: string, position?: number): Promise<FirebotViewer>;
13
14
  getTopMetadata(metadataKey: string, count: number): Promise<FirebotViewer[]>;
14
15
  updateViewerMetadata(username: string, key: string, value: string, propertyPath?: string): Promise<void>;
16
+ setViewerMetadataByUserId(userId: string, key: string, value: string, propertyPath?: string): Promise<void>;
15
17
  removeViewerMetadata(username: string, key: string): Promise<void>;
18
+ deleteViewerMetadataByUserId(userId: string, key: string): Promise<void>;
16
19
  }
17
20
  declare const viewerMetadataManager: ViewerMetadataManager;
18
21
  export = viewerMetadataManager;
@@ -1,6 +1,6 @@
1
1
  import type { BasicViewer, FirebotViewer } from "../../types";
2
2
  declare class ViewerOnlineStatusManager {
3
- private logger;
3
+ private _logger;
4
4
  private _updateLastSeenIntervalId;
5
5
  private _updateTimeIntervalId;
6
6
  constructor();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowbartools/firebot-types",
3
- "version": "5.67.0-alpha26",
3
+ "version": "5.67.0-alpha27",
4
4
  "description": "Type definitions and plugin API for Firebot plugins.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,21 @@
1
+ declare enum UpdateType {
2
+ NONE = "none",
3
+ PREVIOUS_VERSION = "previousversion",// 1.0.0 -> 1.1.0-beta,
4
+ PRERELEASE = "prerelease",// 1.0.0 -> 1.1.0-beta
5
+ OFFICIAL = "official",// 1.0.0-beta -> 1.0.0
6
+ PATCH = "patch",// 1.0.0 -> 1.0.1
7
+ MINOR = "minor",// 1.0.0 -> 1.1.0
8
+ MAJOR = "major",// 1.0.0 -> 2.0.0,
9
+ MAJOR_PRERELEASE = "majorprerelease"
10
+ }
11
+ interface VersionInfo {
12
+ major: number;
13
+ minor?: number;
14
+ patch?: number;
15
+ prereleaseTag?: string;
16
+ prereleaseVersion?: number;
17
+ nightlyVersion?: string;
18
+ }
19
+ declare function parseVersion(version: string): VersionInfo;
20
+ declare function compareVersions(newVersion: string, currentVersion: string): UpdateType;
21
+ export { UpdateType, parseVersion, compareVersions };
package/types/chat.d.ts CHANGED
@@ -51,6 +51,7 @@ export type FirebotParsedMessagePart = {
51
51
  export type FirebotChatMessage = {
52
52
  id: string;
53
53
  timestamp?: number;
54
+ timestampDisplay?: string;
54
55
  username: string;
55
56
  userId: string;
56
57
  userDisplayName?: string;
@@ -83,6 +84,9 @@ export type FirebotChatMessage = {
83
84
  isAutoModHeld?: boolean;
84
85
  autoModStatus?: "pending" | "approved" | "denied" | "expired";
85
86
  autoModReason?: string;
87
+ autoModHeldMessageId?: string;
88
+ autoModResolvedBy?: string;
89
+ autoModErrorMessage?: string;
86
90
  isFirstChat?: boolean;
87
91
  isReturningChatter?: boolean;
88
92
  isRaider?: boolean;
@@ -113,6 +117,12 @@ export type FirebotChatMessage = {
113
117
  cost: number;
114
118
  imageUrl: string;
115
119
  };
120
+ powerUp?: {
121
+ id: string;
122
+ name: string;
123
+ bits: number;
124
+ imageUrl: string;
125
+ };
116
126
  isGigantified?: boolean;
117
127
  };
118
128
  export type FirebotEmote = {
@@ -134,4 +144,70 @@ export type SharedChatParticipant = {
134
144
  broadcasterDisplayName: string;
135
145
  profilePictureUrl: string;
136
146
  };
147
+ type DashboardChatFeedItemType = "message" | "alert" | "reward-redemption" | "power-up-redemption";
148
+ type DashboardChatFeedItemBase = {
149
+ id: string;
150
+ type: DashboardChatFeedItemType;
151
+ };
152
+ export type DashboardChatMessageData = FirebotChatMessage & {
153
+ deleted?: boolean;
154
+ isHiddenFromChatFeed?: boolean;
155
+ customHighlightColor?: string;
156
+ customBannerIcon?: string;
157
+ customBannerText?: string;
158
+ };
159
+ export type DashboardChatFeedMessageItem = DashboardChatFeedItemBase & {
160
+ type: "message";
161
+ data: DashboardChatMessageData;
162
+ rewardMatched?: boolean;
163
+ powerUpMatched?: boolean;
164
+ };
165
+ export type DashboardChatFeedAlertItem = DashboardChatFeedItemBase & {
166
+ type: "alert";
167
+ message: string;
168
+ icon: string;
169
+ };
170
+ export type DashboardChatFeedRewardData = {
171
+ id: string;
172
+ status: string;
173
+ messageText: string;
174
+ user: {
175
+ id: string;
176
+ username: string;
177
+ displayName: string;
178
+ };
179
+ reward: {
180
+ id: string;
181
+ name: string;
182
+ cost: number;
183
+ imageUrl: string;
184
+ };
185
+ };
186
+ export type DashboardChatFeedRewardItem = DashboardChatFeedItemBase & {
187
+ type: "reward-redemption";
188
+ data: DashboardChatFeedRewardData;
189
+ rewardMatched?: boolean;
190
+ };
191
+ export type DashboardChatFeedPowerUpData = {
192
+ id: string;
193
+ status: string;
194
+ messageText: string;
195
+ user: {
196
+ id: string;
197
+ username: string;
198
+ displayName: string;
199
+ };
200
+ powerUp: {
201
+ id: string;
202
+ name: string;
203
+ bits: number;
204
+ imageUrl: string;
205
+ };
206
+ };
207
+ export type DashboardChatFeedPowerUpItem = DashboardChatFeedItemBase & {
208
+ type: "power-up-redemption";
209
+ data: DashboardChatFeedPowerUpData;
210
+ powerUpMatched?: boolean;
211
+ };
212
+ export type DashboardChatFeedItem = DashboardChatFeedMessageItem | DashboardChatFeedAlertItem | DashboardChatFeedRewardItem | DashboardChatFeedPowerUpItem;
137
213
  export {};
@@ -43,7 +43,7 @@ export interface IntegrationEvents {
43
43
  disconnected: (id: string) => void;
44
44
  "settings-update": (id: string, settings: Record<string, any>) => void;
45
45
  }
46
- type LinkData = {
46
+ export type LinkData = {
47
47
  accountId: string;
48
48
  } | {
49
49
  auth: Record<string, unknown>;
@@ -66,4 +66,3 @@ export type IntegrationWithUnknowns = {
66
66
  definition: IntegrationDefinition & ObjectOfUnknowns;
67
67
  integration: IntegrationController & ObjectOfUnknowns;
68
68
  };
69
- export {};
@@ -8,6 +8,8 @@ import type { InstalledPlugin } from "./plugins";
8
8
  import type { PluginWebhook } from "./webhooks";
9
9
  import type { ReplaceVariable, VariableConfig } from "./variables";
10
10
  import type { FilterConfig, PresetFilterConfig, TextFilterConfig } from "../backend/events/filters/filter-factory";
11
+ import type { FirebotViewer } from "./viewers";
12
+ import type { Currency } from "./currency";
11
13
  export type PluginLogMethod = (message: string, ...meta: unknown[]) => void;
12
14
  export interface PluginLoggerApi {
13
15
  debug: PluginLogMethod;
@@ -158,12 +160,89 @@ export interface Accounts {
158
160
  }
159
161
  export interface PluginWebServerApi {
160
162
  /**
161
- * Sends a custom event over the internal Firebot WebSocket server
163
+ * Send a custom event over the internal Firebot WebSocket server
162
164
  * @param name Name of the event to send. Full event name will be `custom-event:{name}`
163
165
  * @param data Any optional data you would like to send with the event
164
166
  */
165
167
  sendWebSocketEvent(name: string, data?: unknown): any;
166
168
  }
169
+ export interface PluginViewersApi {
170
+ /**
171
+ * Retrieve a Firebot user from the viewer database via their Twitch user ID.
172
+ * Returns `undefined` if the viewer isn't in the database, or the viewer database is disabled.
173
+ * @param userId The viewer's Twitch user ID
174
+ */
175
+ getViewerByUserId(userId: string): Promise<FirebotViewer>;
176
+ /**
177
+ * Retrieve a Firebot user from the viewer database via their Twitch username.
178
+ * Returns `undefined` if the viewer isn't in the database, or the viewer database is disabled.
179
+ * @param username The viewer's Twitch username
180
+ */
181
+ getViewerByUsername(username: string): Promise<FirebotViewer>;
182
+ /**
183
+ * Get a metadata value for a given user
184
+ * @param userId The viewer's Twitch user ID
185
+ * @param key Key of the metadata value to get
186
+ * @param propertyPath (Optional) Dot-notated property path
187
+ */
188
+ getViewerMetadataValue(userId: string, key: string, propertyPath: string): Promise<unknown>;
189
+ /**
190
+ * Set a metadata value for a given user
191
+ * @param userId The viewer's Twitch user ID
192
+ * @param key Key of the metadata value to set
193
+ * @param value Data to store
194
+ * @param propertyPath (Optional) Dot-notated property path
195
+ */
196
+ setViewerMetadataValue(userId: string, key: string, value: string, propertyPath: string): Promise<void>;
197
+ /**
198
+ * Delete a metadata value for a given user
199
+ * @param userId The viewer's Twitch user ID
200
+ * @param key Key of the metadata value to delete
201
+ */
202
+ deleteViewerMetadataValue(userId: string, key: string): Promise<void>;
203
+ }
204
+ export interface PluginCurrencyApi {
205
+ /**
206
+ * Get an array of all currencies
207
+ */
208
+ getAllCurrencies(): Array<Currency>;
209
+ /**
210
+ * Get a specific currency by its ID
211
+ * @param id ID of the currency
212
+ */
213
+ getCurrencyById(id: string): Currency;
214
+ /**
215
+ * Get a specific currency by its name
216
+ * @param name Name of the currency
217
+ */
218
+ getCurrencyByName(name: string): Currency;
219
+ /**
220
+ * Get the amount of a viewer's currency
221
+ * @param userId The viewer's Twitch user ID
222
+ * @param currencyId The ID of the currency
223
+ */
224
+ getViewerCurrency(userId: string, currencyId: string): Promise<number>;
225
+ /**
226
+ * Add to or subtract from a viewer's currency
227
+ * @param userId The viewer's Twitch user ID
228
+ * @param currencyId The ID of the currency
229
+ * @param amount An amount to add to the specified currency for the viewer. Negative values will subtract that amount.
230
+ */
231
+ addOrSubtractViewerCurrency(userId: string, currencyId: string, amount: number): Promise<boolean>;
232
+ /**
233
+ * Set a viewer's currency to a specific amount
234
+ * @param userId The viewer's Twitch user ID
235
+ * @param currencyId The ID of the currency
236
+ * @param amount The total amount of the specified currency the viewer should have
237
+ */
238
+ setViewerCurrency(userId: string, currencyId: string, amount: number): Promise<boolean>;
239
+ /**
240
+ * Get an array of viewers with a specific currency, sorted by highest amount first
241
+ * @param currencyId The ID of the currency
242
+ * @param count The total number of viewers to retrieve
243
+ */
244
+ getCurrencyLeaderboard(currencyId: string, count: number): Promise<Array<FirebotViewer>>;
245
+ }
167
246
  export interface PluginVariableFactoryApi {
168
247
  createEventDataVariable(config: VariableConfig): ReplaceVariable;
169
248
  }
@@ -190,6 +269,10 @@ export interface FirebotPluginApi {
190
269
  events: PluginEventsApi;
191
270
  /** Run effect lists. */
192
271
  effects: PluginEffectsApi;
272
+ /** Access to the viewer database, including viewer metadata */
273
+ viewers: PluginViewersApi;
274
+ /** Access to currencies, including viewer currency amounts and leaderboards */
275
+ currency: PluginCurrencyApi;
193
276
  /** Access to Firebot's Twitch API wrappers (Helix, chat, auth, etc). */
194
277
  twitch: PluginTwitchApi;
195
278
  /** This plugin's saved parameter values. */