@crowbartools/firebot-types 5.67.0-alpha25 → 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.
- package/backend/chat/active-user-handler.d.ts +7 -1
- package/backend/chat/frontend-chat-manager.d.ts +36 -0
- package/backend/common/connection-manager.d.ts +40 -0
- package/backend/common/profile-manager.d.ts +3 -0
- package/backend/core/update-manager.d.ts +16 -0
- package/backend/currency/currency-manager.d.ts +1 -0
- package/backend/database/turso-connection-registry.d.ts +28 -0
- package/backend/events/activity-feed-manager.d.ts +8 -1
- package/backend/events/event-manager.d.ts +1 -1
- package/backend/overlay-widgets/builtin-types/index.d.ts +2 -2
- package/backend/plugins/executors/plugin-executor.interface.d.ts +1 -0
- package/backend/plugins/plugin-api/internal/message-broker.d.ts +20 -0
- package/backend/plugins/plugin-api/namespaces/currency.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/messaging.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/viewers.d.ts +2 -0
- package/backend/plugins/plugin-manager.d.ts +19 -7
- package/backend/quotes/quote-manager.d.ts +7 -1
- package/backend/roles/twitch-roles-manager.d.ts +4 -0
- package/backend/streaming-platforms/twitch/api/eventsub/eventsub-chat-helpers.d.ts +1 -0
- package/backend/streaming-platforms/twitch/api/resource/moderation.d.ts +1 -1
- package/backend/streaming-platforms/twitch/events/bits.d.ts +1 -1
- package/backend/ui-extensions/ui-extension-manager.d.ts +4 -2
- package/backend/utils/index.d.ts +1 -0
- package/backend/utils/versions.d.ts +9 -0
- package/backend/viewers/viewer-database.d.ts +3 -1
- package/backend/viewers/viewer-metadata-manager.d.ts +3 -0
- package/backend/viewers/viewer-online-status-manager.d.ts +1 -1
- package/package.json +1 -1
- package/shared/compare-versions.d.ts +21 -0
- package/types/chat.d.ts +76 -0
- package/types/conditions.d.ts +36 -0
- package/types/index.d.ts +1 -0
- package/types/integrations.d.ts +1 -2
- package/types/plugin-api.d.ts +117 -1
- package/types/plugins.d.ts +30 -30
- package/types/ui/modal-factory.d.ts +9 -0
- package/types/ui-extensions.d.ts +3 -1
- package/types/viewers.d.ts +9 -0
- 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
|
|
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>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Database } from "@tursodatabase/database";
|
|
2
|
+
/**
|
|
3
|
+
* Registry for Turso databases
|
|
4
|
+
*
|
|
5
|
+
* Each named database lives in its own file under the
|
|
6
|
+
* profile's databases/ dir (ie databases/quotes.db)
|
|
7
|
+
*/
|
|
8
|
+
declare class TursoConnectionRegistry {
|
|
9
|
+
private logger;
|
|
10
|
+
private connections;
|
|
11
|
+
constructor();
|
|
12
|
+
private getDatabasePath;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a cached connection for the named database,
|
|
15
|
+
* creating the db file if it doesn't exist
|
|
16
|
+
*/
|
|
17
|
+
getConnection(name: string): Promise<Database>;
|
|
18
|
+
private open;
|
|
19
|
+
/**
|
|
20
|
+
* Attaches another registered database to the given connection so queries
|
|
21
|
+
* can join across files, ie:
|
|
22
|
+
* "SELECT ... FROM quotes q JOIN viewers.viewers v ON ..."
|
|
23
|
+
*/
|
|
24
|
+
attach(db: Database, name: string, alias: string): Promise<void>;
|
|
25
|
+
private closeAll;
|
|
26
|
+
}
|
|
27
|
+
declare const registry: TursoConnectionRegistry;
|
|
28
|
+
export { registry as TursoConnectionRegistry };
|
|
@@ -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
|
|
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("./
|
|
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,20 @@
|
|
|
1
|
+
import type { Logger } from "winston";
|
|
2
|
+
import type { ScopedIpc } from "../../../../types/plugin-api";
|
|
3
|
+
export interface MessagingScope {
|
|
4
|
+
ipc: ScopedIpc;
|
|
5
|
+
dispose: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare class PluginMessageBroker {
|
|
8
|
+
private readonly bus;
|
|
9
|
+
private readonly pendingRequests;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Deep-clone a payload to:
|
|
13
|
+
* - Isolate senders/receivers from shared mutable references
|
|
14
|
+
* - Reject non-serializable payloads (ie functions)
|
|
15
|
+
*/
|
|
16
|
+
private enforceSerialization;
|
|
17
|
+
createScope(pluginId: string, logger: Logger): MessagingScope;
|
|
18
|
+
}
|
|
19
|
+
export declare const pluginMessageBroker: PluginMessageBroker;
|
|
20
|
+
export {};
|
|
@@ -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
|
|
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<
|
|
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 };
|
|
@@ -18,7 +18,13 @@ declare class QuoteManager {
|
|
|
18
18
|
}>;
|
|
19
19
|
constructor();
|
|
20
20
|
private regExpEscape;
|
|
21
|
+
private buildSearchPattern;
|
|
22
|
+
private rowToQuote;
|
|
21
23
|
loadQuoteDatabase(): Promise<void>;
|
|
24
|
+
private createSchema;
|
|
25
|
+
private migrateFromNeDb;
|
|
26
|
+
private insertQuoteRow;
|
|
27
|
+
private getQuoteCount;
|
|
22
28
|
getCurrentQuoteId(): Promise<number>;
|
|
23
29
|
getNextQuoteId(): Promise<number>;
|
|
24
30
|
setQuoteIdIncrementer(number: number): Promise<number>;
|
|
@@ -27,13 +33,13 @@ declare class QuoteManager {
|
|
|
27
33
|
updateQuote(quote: Quote, dontSendUiUpdateEvent?: boolean): Promise<Quote>;
|
|
28
34
|
removeQuote(quoteId: number, dontSendUiUpdateEvent?: boolean): Promise<void>;
|
|
29
35
|
getQuote(quoteId: number): Promise<Quote>;
|
|
36
|
+
private getRandomQuoteWhere;
|
|
30
37
|
getRandomQuoteByDate(dateConfig: DateConfig): Promise<Quote>;
|
|
31
38
|
getRandomQuoteByAuthor(author: string): Promise<Quote>;
|
|
32
39
|
getRandomQuoteByGame(gameSearch: string): Promise<Quote>;
|
|
33
40
|
getRandomQuoteContainingText(text: string): Promise<Quote>;
|
|
34
41
|
getRandomQuote(): Promise<Quote>;
|
|
35
42
|
getAllQuotes(): Promise<Quote[]>;
|
|
36
|
-
private updateQuoteId;
|
|
37
43
|
recalculateQuoteIds(): Promise<void>;
|
|
38
44
|
exportQuotesToFile(filepath: string): Promise<boolean>;
|
|
39
45
|
}
|
|
@@ -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
|
|
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
|
-
|
|
9
|
+
queueUIExtensionRemoval(extensionId: string): void;
|
|
10
|
+
setUIReadyForExtensions(): void;
|
|
9
11
|
private prepareExtensionForFrontend;
|
|
10
12
|
private prepareFunc;
|
|
11
13
|
}
|
package/backend/utils/index.d.ts
CHANGED
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -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 {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type EventEmitter from "events";
|
|
2
|
+
import { Trigger, TriggersObject, TriggerType } from "./triggers";
|
|
3
|
+
type PresetValue = {
|
|
4
|
+
value: string;
|
|
5
|
+
display: string;
|
|
6
|
+
};
|
|
7
|
+
type ConditionValueType = "text" | "number" | "preset" | "none";
|
|
8
|
+
export type ConditionSettings<ComparisonTypes extends string, LeftSideValueType extends ConditionValueType, RightSideValueType extends ConditionValueType> = {
|
|
9
|
+
type: string;
|
|
10
|
+
comparisonType: ComparisonTypes;
|
|
11
|
+
leftSideValue: LeftSideValueType extends "number" ? number : LeftSideValueType extends "none" ? undefined : string;
|
|
12
|
+
rightSideValue: RightSideValueType extends "number" ? number : string;
|
|
13
|
+
};
|
|
14
|
+
export type ConditionType<ComparisonTypes extends string, LeftSideValueType extends ConditionValueType, RightSideValueType extends ConditionValueType> = {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
comparisonTypes: ComparisonTypes[];
|
|
19
|
+
rightSideValueType: RightSideValueType;
|
|
20
|
+
leftSideValueType?: LeftSideValueType;
|
|
21
|
+
triggers?: TriggerType[] | TriggersObject;
|
|
22
|
+
leftSideTextPlaceholder?: string;
|
|
23
|
+
rightSideTextPlaceholder?: string;
|
|
24
|
+
getRightSidePresetValues?: (...args: unknown[]) => PresetValue[];
|
|
25
|
+
getLeftSidePresetValues?: (...args: unknown[]) => PresetValue[];
|
|
26
|
+
getRightSideValueDisplay?(condition: ConditionSettings<ComparisonTypes, LeftSideValueType, RightSideValueType>, ...args: unknown[]): string;
|
|
27
|
+
getLeftSideValueDisplay?(condition: ConditionSettings<ComparisonTypes, LeftSideValueType, RightSideValueType>, ...args: unknown[]): string;
|
|
28
|
+
valueIsStillValid?(condition: ConditionSettings<ComparisonTypes, LeftSideValueType, RightSideValueType>, ...args: unknown[]): boolean;
|
|
29
|
+
predicate(conditionSettings: ConditionSettings<ComparisonTypes, LeftSideValueType, RightSideValueType>, trigger: Trigger): boolean | Promise<boolean>;
|
|
30
|
+
};
|
|
31
|
+
export type ConditionManager = EventEmitter & {
|
|
32
|
+
registerConditionType(conditionType: ConditionType<any, any, any>): void;
|
|
33
|
+
getConditionTypeById(conditionTypeId: string): ConditionType<any, any, any>;
|
|
34
|
+
getAllConditionTypes(): ConditionType<any, any, any>[];
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/types/index.d.ts
CHANGED
package/types/integrations.d.ts
CHANGED
|
@@ -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 {};
|
package/types/plugin-api.d.ts
CHANGED
|
@@ -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;
|
|
@@ -106,6 +108,37 @@ export interface PluginFrontendCommunicatorApi {
|
|
|
106
108
|
*/
|
|
107
109
|
fireEventAsync<ReturnPayload = void, ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): Promise<ReturnPayload>;
|
|
108
110
|
}
|
|
111
|
+
export interface PluginMessageEvent<TPayload = unknown> {
|
|
112
|
+
/** The pluginId of the plugin that sent the message. */
|
|
113
|
+
sender: string;
|
|
114
|
+
/** The provided payload. */
|
|
115
|
+
payload: TPayload;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Plugin-to-plugin messaging. Supports both fire-and-forget (`emit`/`on`/`off`)
|
|
119
|
+
* and request/response (`invoke`/`handle`) messaging over a shared event bus,
|
|
120
|
+
* based on Electron's IPC
|
|
121
|
+
*/
|
|
122
|
+
export interface ScopedIpc {
|
|
123
|
+
/** Broadcast a message on a channel. */
|
|
124
|
+
emit(channel: string, data: unknown): void;
|
|
125
|
+
/**
|
|
126
|
+
* Listen for messages on a channel.
|
|
127
|
+
* Returns an `unsubscribe` function.
|
|
128
|
+
*/
|
|
129
|
+
on<TPayload = unknown>(channel: string, callback: (event: PluginMessageEvent<TPayload>) => void): () => void;
|
|
130
|
+
/** Remove a previously registered `on` listener. */
|
|
131
|
+
off(channel: string, callback: (...args: never[]) => void): void;
|
|
132
|
+
/**
|
|
133
|
+
* Send a request on a channel and await a response. Rejects if
|
|
134
|
+
* no handler responds within a 10s timeout or if the handler throws.
|
|
135
|
+
*/
|
|
136
|
+
invoke<TRequestPayload = unknown, TResponseData = unknown>(channel: string, data?: TRequestPayload): Promise<TResponseData>;
|
|
137
|
+
/**
|
|
138
|
+
* Register the handler for a request channel.
|
|
139
|
+
*/
|
|
140
|
+
handle<TRequestPayload = unknown, TResponseData = unknown>(channel: string, handlerFn: (payload: TRequestPayload, sender: string) => Promise<TResponseData> | TResponseData): void;
|
|
141
|
+
}
|
|
109
142
|
export interface PluginSettingsApi {
|
|
110
143
|
/**
|
|
111
144
|
* Get a Firebot setting value or its default
|
|
@@ -127,12 +160,89 @@ export interface Accounts {
|
|
|
127
160
|
}
|
|
128
161
|
export interface PluginWebServerApi {
|
|
129
162
|
/**
|
|
130
|
-
*
|
|
163
|
+
* Send a custom event over the internal Firebot WebSocket server
|
|
131
164
|
* @param name Name of the event to send. Full event name will be `custom-event:{name}`
|
|
132
165
|
* @param data Any optional data you would like to send with the event
|
|
133
166
|
*/
|
|
134
167
|
sendWebSocketEvent(name: string, data?: unknown): any;
|
|
135
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
|
+
}
|
|
136
246
|
export interface PluginVariableFactoryApi {
|
|
137
247
|
createEventDataVariable(config: VariableConfig): ReplaceVariable;
|
|
138
248
|
}
|
|
@@ -159,12 +269,18 @@ export interface FirebotPluginApi {
|
|
|
159
269
|
events: PluginEventsApi;
|
|
160
270
|
/** Run effect lists. */
|
|
161
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;
|
|
162
276
|
/** Access to Firebot's Twitch API wrappers (Helix, chat, auth, etc). */
|
|
163
277
|
twitch: PluginTwitchApi;
|
|
164
278
|
/** This plugin's saved parameter values. */
|
|
165
279
|
parameters: PluginParametersApi;
|
|
166
280
|
/** Two-way messaging between the plugin and the frontend. */
|
|
167
281
|
frontendCommunicator: PluginFrontendCommunicatorApi;
|
|
282
|
+
/** Plugin-to-plugin messaging */
|
|
283
|
+
messaging: ScopedIpc;
|
|
168
284
|
/** Notifications owned by this plugin. */
|
|
169
285
|
notifications: PluginNotificationsApi;
|
|
170
286
|
/** Access to installed plugins. */
|
package/types/plugins.d.ts
CHANGED
|
@@ -13,8 +13,29 @@ import type { OverlayWidgetType } from "./overlay-widgets";
|
|
|
13
13
|
import type { PluginHttpRouteDefinition } from "./http-server";
|
|
14
14
|
import type { CustomWebSocketHandler } from "./websocket";
|
|
15
15
|
import type { PluginWebhooks } from "./webhooks";
|
|
16
|
+
import { ConditionType } from "./conditions";
|
|
16
17
|
type NoResult = Awaitable<void>;
|
|
17
18
|
type GenericParameters = Record<string, unknown>;
|
|
19
|
+
type FontAwesomeIcon = {
|
|
20
|
+
type: "font-awesome";
|
|
21
|
+
/**
|
|
22
|
+
* A FontAwesome icon name shown in the UI (eg. "fa-cogs").
|
|
23
|
+
*/
|
|
24
|
+
name: `fa-${string}`;
|
|
25
|
+
/**
|
|
26
|
+
* A css color value (eg. "#FF0000") used for the icon.
|
|
27
|
+
*/
|
|
28
|
+
color?: string;
|
|
29
|
+
};
|
|
30
|
+
type CustomIcon = {
|
|
31
|
+
type: "custom";
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A css color value (eg. "#FF0000") used for the background of the icon.
|
|
35
|
+
*/
|
|
36
|
+
backgroundColor?: string;
|
|
37
|
+
};
|
|
38
|
+
export type PluginIcon = FontAwesomeIcon | CustomIcon;
|
|
18
39
|
export type ManagedPluginManifest = {
|
|
19
40
|
name: string;
|
|
20
41
|
author: string;
|
|
@@ -34,16 +55,20 @@ export type ManagedPluginManifest = {
|
|
|
34
55
|
minimumFirebotVersion?: ManifestFirebotVersion;
|
|
35
56
|
maximumFirebotVersion?: ManifestFirebotVersion;
|
|
36
57
|
};
|
|
37
|
-
export type
|
|
58
|
+
export type ManagedPluginBase = {
|
|
38
59
|
author: string;
|
|
39
60
|
name: string;
|
|
40
61
|
version: string;
|
|
41
62
|
};
|
|
42
|
-
export type
|
|
63
|
+
export type ManagedPlugin = ManagedPluginBase & {
|
|
43
64
|
manifest: ManagedPluginManifest;
|
|
44
65
|
};
|
|
66
|
+
export type ManagedPluginExtended = ManagedPlugin & {
|
|
67
|
+
installed: boolean;
|
|
68
|
+
installedVersion?: string;
|
|
69
|
+
};
|
|
45
70
|
export type ManagedPluginUpdateRequest = {
|
|
46
|
-
plugins: Array<
|
|
71
|
+
plugins: Array<ManagedPluginBase>;
|
|
47
72
|
firebotVersion: ManifestFirebotVersion;
|
|
48
73
|
};
|
|
49
74
|
export type InstalledPluginConfig<Params extends GenericParameters = GenericParameters> = {
|
|
@@ -51,7 +76,7 @@ export type InstalledPluginConfig<Params extends GenericParameters = GenericPara
|
|
|
51
76
|
fileName: string;
|
|
52
77
|
enabled?: boolean;
|
|
53
78
|
legacyImport?: boolean;
|
|
54
|
-
managedPluginDetails?:
|
|
79
|
+
managedPluginDetails?: ManagedPluginBase;
|
|
55
80
|
parameters: Params;
|
|
56
81
|
};
|
|
57
82
|
export type PluginContext<Params extends FirebotParams = FirebotParams> = {
|
|
@@ -70,26 +95,6 @@ export interface ManifestFirebotVersion {
|
|
|
70
95
|
minor?: number;
|
|
71
96
|
patch?: number;
|
|
72
97
|
}
|
|
73
|
-
type FontAwesomeIcon = {
|
|
74
|
-
type: "font-awesome";
|
|
75
|
-
/**
|
|
76
|
-
* A FontAwesome icon name shown in the UI (eg. "fa-cogs").
|
|
77
|
-
*/
|
|
78
|
-
name: `fa-${string}`;
|
|
79
|
-
/**
|
|
80
|
-
* A css color value (eg. "#FF0000") used for the icon.
|
|
81
|
-
*/
|
|
82
|
-
color?: string;
|
|
83
|
-
};
|
|
84
|
-
type CustomIcon = {
|
|
85
|
-
type: "custom";
|
|
86
|
-
url: string;
|
|
87
|
-
/**
|
|
88
|
-
* A css color value (eg. "#FF0000") used for the background of the icon.
|
|
89
|
-
*/
|
|
90
|
-
backgroundColor?: string;
|
|
91
|
-
};
|
|
92
|
-
export type PluginIcon = FontAwesomeIcon | CustomIcon;
|
|
93
98
|
export interface Manifest {
|
|
94
99
|
name: string;
|
|
95
100
|
version: string;
|
|
@@ -119,11 +124,6 @@ export interface Manifest {
|
|
|
119
124
|
* The icon to be displayed for the plugin.
|
|
120
125
|
*/
|
|
121
126
|
icon?: PluginIcon;
|
|
122
|
-
/**
|
|
123
|
-
* If true, the plugin will be initialized before parameters are shown to the user,
|
|
124
|
-
* allowing the plugin to provide custom parameter types that can be used in its own parametersSchema.
|
|
125
|
-
*/
|
|
126
|
-
initBeforeShowingParams?: boolean;
|
|
127
127
|
}
|
|
128
128
|
export interface PluginBase<Params extends FirebotParams = FirebotParams> {
|
|
129
129
|
manifest: Manifest;
|
|
@@ -144,6 +144,7 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Pl
|
|
|
144
144
|
integrations?: DynamicArray<Integration<any>>;
|
|
145
145
|
filters?: DynamicArray<EventFilter>;
|
|
146
146
|
restrictions?: DynamicArray<RestrictionType<any>>;
|
|
147
|
+
conditions?: DynamicArray<ConditionType<any, any, any>>;
|
|
147
148
|
systemCommands?: DynamicArray<SystemCommand<any>>;
|
|
148
149
|
games?: DynamicArray<FirebotGame>;
|
|
149
150
|
frontendListeners?: DynamicArray<FrontendListener>;
|
|
@@ -211,7 +212,6 @@ type LegacyCustomScriptManifest = {
|
|
|
211
212
|
author: string;
|
|
212
213
|
website?: string;
|
|
213
214
|
startupOnly?: boolean;
|
|
214
|
-
initBeforeShowingParams?: boolean;
|
|
215
215
|
firebotVersion?: "5";
|
|
216
216
|
};
|
|
217
217
|
export type LegacyScriptData = {
|
|
@@ -19,4 +19,13 @@ export type ModalFactory = {
|
|
|
19
19
|
trigger?: TriggerType;
|
|
20
20
|
triggerMeta?: unknown;
|
|
21
21
|
}, callback: (result: T) => void, dismissCallback?: () => void) => void;
|
|
22
|
+
showConfirmationModal: (options: {
|
|
23
|
+
title: string;
|
|
24
|
+
question: string;
|
|
25
|
+
tip?: string;
|
|
26
|
+
cancelLabel?: string;
|
|
27
|
+
cancelBtnType?: string;
|
|
28
|
+
confirmLabel?: string;
|
|
29
|
+
confirmBtnType?: string;
|
|
30
|
+
}) => Promise<boolean>;
|
|
22
31
|
};
|
package/types/ui-extensions.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ export type AngularJsPage = BasePage & {
|
|
|
13
13
|
};
|
|
14
14
|
export type IframePage = BasePage & {
|
|
15
15
|
type: 'iframe';
|
|
16
|
+
url: string;
|
|
16
17
|
};
|
|
18
|
+
export type UiExtensionPage = AngularJsPage | IframePage;
|
|
17
19
|
export type AngularJsFactory = {
|
|
18
20
|
name: string;
|
|
19
21
|
function: Function;
|
|
@@ -80,7 +82,7 @@ export type UIExtension = {
|
|
|
80
82
|
/**
|
|
81
83
|
* Adds new sidebar entries under an "Extensions" category
|
|
82
84
|
*/
|
|
83
|
-
pages?:
|
|
85
|
+
pages?: UiExtensionPage[];
|
|
84
86
|
/**
|
|
85
87
|
* Add your own AngularJS services, components, directives, filters
|
|
86
88
|
*/
|
package/types/viewers.d.ts
CHANGED
|
@@ -26,3 +26,12 @@ export interface BasicViewer {
|
|
|
26
26
|
profilePicUrl?: string;
|
|
27
27
|
}
|
|
28
28
|
export type NewFirebotViewer = BasicViewer & Partial<Omit<FirebotViewer, "_id" | "username" | "displayName" | "twitchRoles" | "profilePicUrl">>;
|
|
29
|
+
export type FrontendViewer = {
|
|
30
|
+
id: string;
|
|
31
|
+
username: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
roles: string[];
|
|
34
|
+
profilePicUrl: string;
|
|
35
|
+
active: boolean;
|
|
36
|
+
disableViewerList?: boolean;
|
|
37
|
+
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { FirebotChatMessage } from "../../types";
|
|
2
|
-
declare class FirebotFrontendChatHelpers {
|
|
3
|
-
private logger;
|
|
4
|
-
private _pendingMessageCache;
|
|
5
|
-
private sendChatMessageToChatWidget;
|
|
6
|
-
sendChatMessageToFrontend(chatMessage: FirebotChatMessage): void;
|
|
7
|
-
private deleteMessageFromChatWidget;
|
|
8
|
-
deleteMessageFromFrontend(messageId: string, animate?: boolean): void;
|
|
9
|
-
deleteUserMessagesFromFrontend(username: string): void;
|
|
10
|
-
clearChatFeed(moderatorName: string): void;
|
|
11
|
-
updateMessageAutomodStatus(messageId: string, newStatus: FirebotChatMessage["autoModStatus"], resolverName: string, resolverId: string, flaggedPhrases: string[]): void;
|
|
12
|
-
}
|
|
13
|
-
declare const frontendChatHelpers: FirebotFrontendChatHelpers;
|
|
14
|
-
export { frontendChatHelpers as FirebotFrontendChatHelpers };
|