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

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.
@@ -10,58 +10,96 @@ import type { ReplaceVariable, VariableConfig } from "./variables";
10
10
  import type { FilterConfig, PresetFilterConfig, TextFilterConfig } from "../backend/events/filters/filter-factory";
11
11
  import type { FirebotViewer } from "./viewers";
12
12
  import type { Currency } from "./currency";
13
+ export interface Accounts {
14
+ /** Streamer account information */
15
+ streamer: FirebotAccount;
16
+ /** Bot account information. May be null if user has not logged in with a bot account. */
17
+ bot: FirebotAccount;
18
+ }
13
19
  export type PluginLogMethod = (message: string, ...meta: unknown[]) => void;
14
20
  export interface PluginLoggerApi {
21
+ /** Log a message at the debug log level. These may not appear in log files if the user has not enabled debug logging. */
15
22
  debug: PluginLogMethod;
23
+ /** Log a message at the info log level */
16
24
  info: PluginLogMethod;
25
+ /** Log a message at the warn log level */
17
26
  warn: PluginLogMethod;
27
+ /** Log a message at the error log level */
18
28
  error: PluginLogMethod;
19
29
  }
20
- export interface PluginWebhooksApi {
21
- /** Look up a webhook by name. */
22
- get(name: string): PluginWebhook | null;
23
- /** All webhooks owned by this plugin. */
24
- list(): PluginWebhook[];
25
- /** Public URL for a webhook by name, or null if not found. */
26
- getUrl(name: string): string | null;
30
+ export interface PluginSettingsApi {
31
+ /**
32
+ * Get a Firebot setting value or its default
33
+ *
34
+ * @param settingName Name of the setting to get
35
+ * @returns Setting value, or the default if one isn't explicitly set
36
+ */
37
+ getSetting<SettingName extends keyof FirebotSettingsTypes>(settingName: SettingName): FirebotSettingsTypes[SettingName];
27
38
  }
28
- /**
29
- * Simple per-plugin storage scoped to the plugin's data directory.
30
- * Provides helpers for storing/loading JSON values
31
- * plus generic file read/write for anything else.
32
- */
33
39
  export interface PluginStorageApi {
34
40
  /** Absolute path to this plugin's data directory. */
35
41
  readonly path: string;
36
- /** Save a value as JSON under the given key. The key becomes the filename with a `.json` extension. */
37
- setJson(key: string, value: unknown): Promise<void>;
38
42
  /**
39
- * Load a JSON value previously saved with `setJson`. Returns `null` if
40
- * nothing has been stored under this key.
43
+ * Save a value as JSON under the given key. The key becomes the filename with a `.json` extension.
44
+ * @param key The name of the key to store
45
+ * @param value The value to store
41
46
  */
47
+ setJson(key: string, value: unknown): Promise<void>;
48
+ /**
49
+ * Load a JSON value previously saved with {@linkcode setJson}
50
+ * @param key The name of the key to get
51
+ * @returns A `Promise` with either the data of type `T` or `null` if nothing has been stored under this key
52
+ */
42
53
  getJson<T = unknown>(key: string): Promise<T | null>;
43
- /** Delete the JSON value stored under the given key. No-op if missing. */
54
+ /**
55
+ * Delete the JSON value stored under the given key. No-op if missing.
56
+ * @param key The name of the key to delete
57
+ */
44
58
  deleteJson(key: string): Promise<void>;
45
- /** Check whether a file exists in the data directory. */
59
+ /**
60
+ * Check whether a file exists in the data directory.
61
+ * @param name Name of the file to check
62
+ * @returns A `Promise<boolean>` indicating if the file exists
63
+ */
46
64
  fileExists(name: string): Promise<boolean>;
47
- /** Read a file's raw bytes. Returns `null` if it doesn't exist. */
65
+ /**
66
+ * Read a file's raw bytes
67
+ * @param name Name of the file to read
68
+ * @returns A `Promise` with either a `Buffer` containing the file's contents, or `null` if the file doesn't exist
69
+ */
48
70
  readFile(name: string): Promise<Buffer | null>;
49
- /** Read a file as text. Returns `null` if it doesn't exist. */
71
+ /**
72
+ * Read a file as text
73
+ * @param name Name of the file to read
74
+ * @param encoding Encoding to use when reading the file
75
+ * @returns A `Promise` with either a `string` containing the file's contents, or `null` if the file doesn't exist
76
+ */
50
77
  readTextFile(name: string, encoding?: BufferEncoding): Promise<string | null>;
51
- /** Write contents to a file, creating any missing parent directories. */
78
+ /**
79
+ * Write contents to a file, creating any missing parent directories
80
+ * @param name Name of the file to write
81
+ * @param contents Data to store in the file
82
+ */
52
83
  writeFile(name: string, contents: string | Buffer | Uint8Array): Promise<void>;
53
- /** Delete a file. No-op if it doesn't exist. */
84
+ /**
85
+ * Delete a file. No-op if it doesn't exist.
86
+ * @param name Name of the file to delete
87
+ */
54
88
  deleteFile(name: string): Promise<void>;
55
89
  }
56
90
  export type PluginEventHandler = (event: TriggeredEvent) => void;
57
91
  export interface PluginEventsApi {
58
92
  /**
59
- * Subscribe to all Firebot events as they trigger. Returns an `unsubscribe`
60
- * function.
93
+ * Subscribe to all Firebot events as they trigger
94
+ * @param hander Function to execute when an event is triggered
95
+ * @returns An `unsubscribe` function
61
96
  */
62
97
  onTriggered(handler: PluginEventHandler): () => void;
63
98
  /**
64
- * Manually trigger a Firebot event.
99
+ * Manually trigger a Firebot event
100
+ * @param sourceId Event source ID
101
+ * @param eventId Event ID
102
+ * @param meta (Optional) Any metadata to include with the event
65
103
  */
66
104
  trigger(sourceId: string, eventId: string, meta?: Record<string, unknown>): Promise<void>;
67
105
  }
@@ -70,113 +108,22 @@ export interface PluginEffectsApi {
70
108
  * Run an effect list. Respects the list's run mode and effect queue, if any.
71
109
  * Resolves once the effects have been run (queued lists resolve
72
110
  * immediately).
111
+ * @param context An object containing the context of the effects to run,
112
+ * including any trigger data and effect outputs.
73
113
  */
74
114
  processEffects(context: RunEffectsContext): Promise<unknown>;
75
115
  }
76
- export interface PluginTwitchApi {
77
- /** The full Twitch API surface. See {@linkcode TwitchApi}. */
78
- api: typeof TwitchApi;
79
- }
80
- /**
81
- * Access to this plugin's saved parameter values (the settings configured by
82
- * the user)
83
- */
84
- export interface PluginParametersApi {
85
- getAll<T extends Record<string, unknown> = Record<string, unknown>>(): T;
86
- }
87
- export interface PluginNotificationsApi {
88
- /**
89
- * Create a new notification. Pass `permanentlySave` as `true` to persist it
90
- * across restarts.
91
- */
92
- add(notification: Pick<Notification, "title" | "message" | "type" | "metadata">, permanentlySave?: boolean): Notification;
93
- /** Look up one of this plugin's notifications by id. */
94
- get(id: string): Notification | null;
95
- /** All notifications owned by this plugin. */
96
- getAll(): Notification[];
97
- /** Delete one of this plugin's notifications by id. */
98
- delete(id: string): void;
99
- /** Delete all of this plugin's notifications. */
100
- clearAll(): void;
101
- }
102
- export interface PluginFrontendCommunicatorApi {
103
- /** Send a synchronous event to the frontend. */
104
- send<ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): void;
105
- /**
106
- * Send an asynchronous event to the frontend and await the reply it sends
107
- * back.
108
- */
109
- fireEventAsync<ReturnPayload = void, ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): Promise<ReturnPayload>;
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
- }
142
- export interface PluginSettingsApi {
143
- /**
144
- * Get a Firebot setting value or its default
145
- *
146
- * @param settingName Name of the setting to get
147
- * @returns Setting value, or the default if one isn't explicitly set
148
- */
149
- getSetting<SettingName extends keyof FirebotSettingsTypes>(settingName: SettingName): FirebotSettingsTypes[SettingName];
150
- }
151
- export interface PluginPluginsApi {
152
- /**
153
- * Get a list of currently installed plugins installed by the user
154
- */
155
- getInstalledPlugins(): Promise<Array<InstalledPlugin>>;
156
- }
157
- export interface Accounts {
158
- streamer: FirebotAccount;
159
- bot: FirebotAccount;
160
- }
161
- export interface PluginWebServerApi {
162
- /**
163
- * Send a custom event over the internal Firebot WebSocket server
164
- * @param name Name of the event to send. Full event name will be `custom-event:{name}`
165
- * @param data Any optional data you would like to send with the event
166
- */
167
- sendWebSocketEvent(name: string, data?: unknown): any;
168
- }
169
116
  export interface PluginViewersApi {
170
117
  /**
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.
118
+ * Retrieve a Firebot user from the viewer database via their Twitch user ID
173
119
  * @param userId The viewer's Twitch user ID
120
+ * @returns A {@linkcode FirebotViewer} with the specified user ID, or `undefined` if the viewer isn't in the database or the viewer database is disabled
174
121
  */
175
122
  getViewerByUserId(userId: string): Promise<FirebotViewer>;
176
123
  /**
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.
124
+ * Retrieve a Firebot user from the viewer database via their Twitch username
179
125
  * @param username The viewer's Twitch username
126
+ * @returns A {@linkcode FirebotViewer} with the specified username, or `undefined` if the viewer isn't in the database or the viewer database is disabled
180
127
  */
181
128
  getViewerByUsername(username: string): Promise<FirebotViewer>;
182
129
  /**
@@ -184,6 +131,7 @@ export interface PluginViewersApi {
184
131
  * @param userId The viewer's Twitch user ID
185
132
  * @param key Key of the metadata value to get
186
133
  * @param propertyPath (Optional) Dot-notated property path
134
+ * @returns A `Promise` with the value, or `null` if it doesn't exist
187
135
  */
188
136
  getViewerMetadataValue(userId: string, key: string, propertyPath: string): Promise<unknown>;
189
137
  /**
@@ -204,91 +152,277 @@ export interface PluginViewersApi {
204
152
  export interface PluginCurrencyApi {
205
153
  /**
206
154
  * Get an array of all currencies
155
+ * @returns An array of {@linkcode Currency}
207
156
  */
208
157
  getAllCurrencies(): Array<Currency>;
209
158
  /**
210
159
  * Get a specific currency by its ID
211
- * @param id ID of the currency
160
+ * @param id ID of the currency to get
161
+ * @returns The {@linkcode Currency} with the given ID, or `null` if it doesn't exist
212
162
  */
213
163
  getCurrencyById(id: string): Currency;
214
164
  /**
215
165
  * Get a specific currency by its name
216
- * @param name Name of the currency
166
+ * @param name Name of the currency to get
167
+ * @returns The {@linkcode Currency} with the given name, or `null` if it doesn't exist
217
168
  */
218
169
  getCurrencyByName(name: string): Currency;
219
170
  /**
220
171
  * Get the amount of a viewer's currency
221
172
  * @param userId The viewer's Twitch user ID
222
- * @param currencyId The ID of the currency
173
+ * @param currencyId The ID of the currency to get
174
+ * @returns A `Promise` with the total of the specified currency the viewer currently has
223
175
  */
224
176
  getViewerCurrency(userId: string, currencyId: string): Promise<number>;
225
177
  /**
226
178
  * Add to or subtract from a viewer's currency
227
179
  * @param userId The viewer's Twitch user ID
228
- * @param currencyId The ID of the currency
180
+ * @param currencyId The ID of the currency to adjust
229
181
  * @param amount An amount to add to the specified currency for the viewer. Negative values will subtract that amount.
182
+ * @returns A `Promise` indicating if the adjustment to the viewer's currency was successful
230
183
  */
231
184
  addOrSubtractViewerCurrency(userId: string, currencyId: string, amount: number): Promise<boolean>;
232
185
  /**
233
186
  * Set a viewer's currency to a specific amount
234
187
  * @param userId The viewer's Twitch user ID
235
- * @param currencyId The ID of the currency
188
+ * @param currencyId The ID of the currency to set
236
189
  * @param amount The total amount of the specified currency the viewer should have
190
+ * @returns A `Promise` indicating if setting the viewer's currency was successful
237
191
  */
238
192
  setViewerCurrency(userId: string, currencyId: string, amount: number): Promise<boolean>;
239
193
  /**
240
- * Get an array of viewers with a specific currency, sorted by highest amount first
194
+ * Get an array of viewers with the highest amounts of a specific currency
241
195
  * @param currencyId The ID of the currency
242
196
  * @param count The total number of viewers to retrieve
197
+ * @returns A `Promise` with an array of {@linkcode FirebotViewer} representing the
198
+ * viewers that possess the specified currency, sorted by highest amount first
243
199
  */
244
200
  getCurrencyLeaderboard(currencyId: string, count: number): Promise<Array<FirebotViewer>>;
245
201
  }
202
+ export interface PluginTwitchApi {
203
+ /** The full Twitch API surface. See {@linkcode TwitchApi}. */
204
+ api: typeof TwitchApi;
205
+ }
206
+ export interface PluginParametersApi {
207
+ /**
208
+ * Get all parameter values for this plugin
209
+ * @returns A `Record<string, unknown>` containing the parameter names and their values
210
+ */
211
+ getAll<T extends Record<string, unknown> = Record<string, unknown>>(): T;
212
+ }
213
+ export interface PluginFrontendCommunicatorApi {
214
+ /**
215
+ * Send a synchronous event to the frontend
216
+ * @param eventName Name of the event to send
217
+ * @param (Optional) Any data to send with the event
218
+ */
219
+ send<ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): void;
220
+ /**
221
+ * Send an asynchronous event to the frontend and await the reply it sends
222
+ * back
223
+ * @param eventName Name of the event to send
224
+ * @param (Optional) Any data to send with the event
225
+ * @returns A `Promise` with any response data received
226
+ */
227
+ fireEventAsync<ReturnPayload = void, ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): Promise<ReturnPayload>;
228
+ }
229
+ export interface PluginMessageEvent<TPayload = unknown> {
230
+ /** The pluginId of the plugin that sent the message */
231
+ sender: string;
232
+ /** The provided payload */
233
+ payload: TPayload;
234
+ }
235
+ export interface ScopedIpc {
236
+ /**
237
+ * Broadcast a message on a channel
238
+ * @param channel Name of the channel to send on
239
+ * @param data Data to send with the message
240
+ */
241
+ emit(channel: string, data: unknown): void;
242
+ /**
243
+ * Listen for messages on a channel
244
+ * @param channel Name of the channel to listen on
245
+ * @param callback A function that will get executed when a message is received
246
+ * @returns An `unsubscribe` function
247
+ */
248
+ on<TPayload = unknown>(channel: string, callback: (event: PluginMessageEvent<TPayload>) => void): () => void;
249
+ /**
250
+ * Remove a previously registered {@linkcode on} listener
251
+ * @param channel Name of the channel to stop listening on
252
+ * @param callback The function that was used during registration
253
+ */
254
+ off(channel: string, callback: (...args: never[]) => void): void;
255
+ /**
256
+ * Send a request on a channel and await a response. Rejects if
257
+ * no handler responds within a 10s timeout or if the handler throws.
258
+ * @param channel Name of the channel to invoke on
259
+ * @param data (Optional) Any data to send along with the request
260
+ * @returns A `Promise` with any response data received
261
+ */
262
+ invoke<TRequestPayload = unknown, TResponseData = unknown>(channel: string, data?: TRequestPayload): Promise<TResponseData>;
263
+ /**
264
+ * Register the handler for a request channel
265
+ * @param channel Name of the channel to listen on
266
+ * @param handlerFn A function that is executed when a request
267
+ * is invoked on the specified channel using {@linkcode invoke}
268
+ */
269
+ handle<TRequestPayload = unknown, TResponseData = unknown>(channel: string, handlerFn: (payload: TRequestPayload, sender: string) => Promise<TResponseData> | TResponseData): void;
270
+ }
271
+ export interface PluginNotificationsApi {
272
+ /**
273
+ * Create a new notification
274
+ * @param notification The notification to add
275
+ * @param permanentlySave (Optional) Set as `true` to persist the notification across Firebot restarts
276
+ * @returns The {@linkcode Notification} that was created
277
+ */
278
+ add(notification: Pick<Notification, "title" | "message" | "type" | "metadata">, permanentlySave?: boolean): Notification;
279
+ /**
280
+ * Look up one of this plugin's notifications by ID
281
+ * @param id ID of the notification to retrieve
282
+ * @returns The {@linkcode Notification} with the given ID, or `null` if it doesn't exist
283
+ */
284
+ get(id: string): Notification | null;
285
+ /**
286
+ * All notifications owned by this plugin
287
+ * @returns An array of {@linkcode Notification}
288
+ */
289
+ getAll(): Array<Notification>;
290
+ /**
291
+ * Delete one of this plugin's notifications by ID
292
+ * @param id ID of the notification to delete
293
+ */
294
+ delete(id: string): void;
295
+ /** Delete all of this plugin's notifications */
296
+ clearAll(): void;
297
+ }
298
+ export interface PluginPluginsApi {
299
+ /**
300
+ * Get a list of plugins currently installed by the user
301
+ * @returns A `Promise` with an array of {@linkcode InstalledPlugin} objects
302
+ */
303
+ getInstalledPlugins(): Promise<Array<InstalledPlugin>>;
304
+ }
305
+ export interface PluginWebServerApi {
306
+ /**
307
+ * Send a custom event over the internal Firebot WebSocket server
308
+ * @param name Name of the event to send. Full event name will be `custom-event:{name}`
309
+ * @param data (Optional) Any data you would like to send with the event
310
+ */
311
+ sendWebSocketEvent(name: string, data?: unknown): void;
312
+ /**
313
+ * Create a resource token for a file to be retrieved via the internal HTTP server (e.g. in an overlay).
314
+ * The URL format for retrieval is: `http://localhost:7472/resource/{token}`
315
+ * @param path Full file path of the resource
316
+ * @param ttl (Optional) Time (in seconds) to retain the resource token once it is retrieved the first time.
317
+ * Setting this to `null`/`undefined` will retain the token until Firebot exits.
318
+ * @returns A token representing the resource
319
+ */
320
+ createResourceToken(path: string, ttl?: number): string;
321
+ }
322
+ export interface PluginWebhooksApi {
323
+ /**
324
+ * Look up a webhook by name
325
+ * @param name Name of the webhook
326
+ * @return The {@linkcode PluginWebhook} with the given name, or `null` if it doesn't exist
327
+ */
328
+ get(name: string): PluginWebhook | null;
329
+ /**
330
+ * Get all webhooks owned by this plugin
331
+ * @returns An array of {@linkcode PluginWebhook}
332
+ */
333
+ list(): Array<PluginWebhook>;
334
+ /**
335
+ * Get the public URL for a webhook by name
336
+ * @param name Name of the webhook
337
+ * @returns The webhook's URL, or `null` if it doesn't exist
338
+ */
339
+ getUrl(name: string): string | null;
340
+ }
246
341
  export interface PluginVariableFactoryApi {
342
+ /**
343
+ * Create a basic replace variable based on an event metadata value
344
+ * @param config Configuration data for the new variable
345
+ * @returns A {@linkcode ReplaceVariable} based on the specified config data
346
+ */
247
347
  createEventDataVariable(config: VariableConfig): ReplaceVariable;
248
348
  }
249
349
  export interface PluginEventFilterFactoryApi {
350
+ /**
351
+ * Create a basic event filter based on a text value
352
+ * @param config Configuration data for the new filter
353
+ * @returns An {@linkcode EventFilter} based on the specified config data
354
+ */
250
355
  createTextFilter(config: TextFilterConfig): EventFilter;
356
+ /**
357
+ * Create a basic event filter based on a numeric value
358
+ * @param config Configuration data for the new filter
359
+ * @returns An {@linkcode EventFilter} based on the specified config data
360
+ */
251
361
  createNumberFilter(config: FilterConfig): EventFilter;
362
+ /**
363
+ * Create a basic event filter based on either a text or numeric value
364
+ * @param config Configuration data for the new filter
365
+ * @returns An {@linkcode EventFilter} based on the specified config data
366
+ */
252
367
  createTextOrNumberFilter(config: TextFilterConfig): EventFilter;
368
+ /**
369
+ * Create a basic event filter based on a list of preset values
370
+ * @param config Configuration data for the new filter
371
+ * @returns An {@linkcode EventFilter} based on the specified config data
372
+ */
253
373
  createPresetFilter(config: PresetFilterConfig): EventFilter;
254
374
  }
255
375
  export interface FirebotPluginApi {
256
- /** Running Firebot version, e.g. `"5.67.0"`. */
376
+ /** Running Firebot version, e.g. `"5.67.0"` */
257
377
  version: string;
258
- /** The streamer and bot accounts currently in use. */
378
+ /** The user's streamer and bot accounts currently in use */
259
379
  accounts: Accounts;
260
- /** Scoped logger. */
380
+ /** A scoped logger */
261
381
  logger: PluginLoggerApi;
262
- /** Access to Firebot settings. */
382
+ /** Access to Firebot settings */
263
383
  settings: PluginSettingsApi;
264
- /** Webhooks owned by this plugin. */
265
- webhooks: PluginWebhooksApi;
266
- /** Simple persistent storage rooted at this plugin's data directory. */
384
+ /**
385
+ * Simple per-plugin storage scoped to the plugin's data directory.
386
+ * Provides helpers for storing/loading JSON values
387
+ * plus generic file read/write for anything else.
388
+ */
267
389
  storage: PluginStorageApi;
268
- /** Subscribe to and trigger Firebot events + register event sources. */
390
+ /** Subscribe to and trigger Firebot events */
269
391
  events: PluginEventsApi;
270
- /** Run effect lists. */
392
+ /** Run effect lists */
271
393
  effects: PluginEffectsApi;
272
394
  /** Access to the viewer database, including viewer metadata */
273
395
  viewers: PluginViewersApi;
274
396
  /** Access to currencies, including viewer currency amounts and leaderboards */
275
397
  currency: PluginCurrencyApi;
276
- /** Access to Firebot's Twitch API wrappers (Helix, chat, auth, etc). */
398
+ /** Access to Firebot's Twitch API wrappers (Helix, chat, auth, etc) */
277
399
  twitch: PluginTwitchApi;
278
- /** This plugin's saved parameter values. */
400
+ /**
401
+ * Access to this plugin's saved parameter values (the settings configured by
402
+ * the user)
403
+ */
279
404
  parameters: PluginParametersApi;
280
- /** Two-way messaging between the plugin and the frontend. */
405
+ /**
406
+ * Two-way messaging between the plugin and the Firebot frontend, including
407
+ * UI Extensions
408
+ */
281
409
  frontendCommunicator: PluginFrontendCommunicatorApi;
282
- /** Plugin-to-plugin messaging */
410
+ /**
411
+ * Plugin-to-plugin messaging. Supports both fire-and-forget (`emit`/`on`/`off`)
412
+ * and request/response (`invoke`/`handle`) messaging over a shared event bus,
413
+ * based on Electron's IPC.
414
+ */
283
415
  messaging: ScopedIpc;
284
- /** Notifications owned by this plugin. */
416
+ /** In-app user notifications owned by this plugin */
285
417
  notifications: PluginNotificationsApi;
286
- /** Access to installed plugins. */
418
+ /** Access to installed plugins */
287
419
  plugins: PluginPluginsApi;
288
- /** Firebot internal web server functions. */
420
+ /** Firebot internal web server functions */
289
421
  webServer: PluginWebServerApi;
290
- /** Factory for creating variables based on event data. */
422
+ /** Webhooks owned by this plugin */
423
+ webhooks: PluginWebhooksApi;
424
+ /** Factory functions for creating basic replace variables */
291
425
  variableFactory: PluginVariableFactoryApi;
292
- /** Factory for creating event filters. */
426
+ /** Factory functions for creating basic event filters */
293
427
  eventFilterFactory: PluginEventFilterFactoryApi;
294
428
  }
@@ -2,7 +2,7 @@ import type { EffectType, PluginAdditionalEffectEvents } from "./effects";
2
2
  import type { Trigger } from "./triggers";
3
3
  import type { Awaitable } from "./util-types";
4
4
  import type { PluginAdditionalVariableEvents, ReplaceVariable } from "./variables";
5
- import type { EventFilter, EventSource } from "./events";
5
+ import type { EventFilter, EventSource, PluginAdditionalFilterEvents } from "./events";
6
6
  import type { SystemCommand } from "./commands";
7
7
  import type { RestrictionType } from "./restrictions";
8
8
  import type { FirebotParams, FirebotParameterArray } from "./parameters";
@@ -11,7 +11,7 @@ import type { Integration } from "./integrations";
11
11
  import type { FrontendListener, UIExtension } from "./ui-extensions";
12
12
  import type { OverlayWidgetType } from "./overlay-widgets";
13
13
  import type { PluginHttpRouteDefinition } from "./http-server";
14
- import type { CustomWebSocketHandler } from "./websocket";
14
+ import type { PluginWebSocketHandler } from "./websocket";
15
15
  import type { PluginWebhooks } from "./webhooks";
16
16
  import { ConditionType } from "./conditions";
17
17
  type NoResult = Awaitable<void>;
@@ -36,6 +36,8 @@ type CustomIcon = {
36
36
  backgroundColor?: string;
37
37
  };
38
38
  export type PluginIcon = FontAwesomeIcon | CustomIcon;
39
+ export type PluginCategory = "stream-services" | "social" | "music-media" | "games" | "overlays" | "tools-utilities";
40
+ export type PluginFeature = "effects" | "events" | "variables" | "integrations" | "overlay-widgets" | "games" | "commands" | "ui-extensions";
39
41
  export type ManagedPluginManifest = {
40
42
  name: string;
41
43
  author: string;
@@ -48,6 +50,8 @@ export type ManagedPluginManifest = {
48
50
  releaseDate: string;
49
51
  type: "single-file" | "zip";
50
52
  icon?: PluginIcon;
53
+ category?: PluginCategory;
54
+ features?: PluginFeature[];
51
55
  tags?: string[];
52
56
  repo?: string;
53
57
  website?: string;
@@ -71,6 +75,19 @@ export type ManagedPluginUpdateRequest = {
71
75
  plugins: Array<ManagedPluginBase>;
72
76
  firebotVersion: ManifestFirebotVersion;
73
77
  };
78
+ export type CommunityPluginSearchSortMode = "popular" | "recently-updated" | "name";
79
+ export type CommunityPluginSearchCriteria = {
80
+ query?: string;
81
+ category?: PluginCategory;
82
+ features?: PluginFeature[];
83
+ sortBy: CommunityPluginSearchSortMode;
84
+ page: number;
85
+ pageSize: number;
86
+ };
87
+ export type CommunityPluginSearchResult = {
88
+ items: ManagedPluginExtended[];
89
+ total: number;
90
+ };
74
91
  export type InstalledPluginConfig<Params extends GenericParameters = GenericParameters> = {
75
92
  id: string;
76
93
  fileName: string;
@@ -96,9 +113,21 @@ export interface ManifestFirebotVersion {
96
113
  patch?: number;
97
114
  }
98
115
  export interface Manifest {
116
+ /**
117
+ * Name of the plugin
118
+ */
99
119
  name: string;
120
+ /**
121
+ * Version of the plugin
122
+ */
100
123
  version: string;
124
+ /**
125
+ * Author of the plugin
126
+ */
101
127
  author: string;
128
+ /**
129
+ * Description of the plugin
130
+ */
102
131
  description: string | ManifestDescription;
103
132
  /**
104
133
  * An array of strings that describe or categorize your plugin
@@ -109,8 +138,8 @@ export interface Manifest {
109
138
  */
110
139
  repo?: string;
111
140
  /**
112
- * A link to the plugin's website
113
- * If the repo is on GitHub and the website is not specified, it will default to the GitHub repo URL.
141
+ * A link to the plugin's website. If the repo is on GitHub and the website
142
+ * is not specified, it will default to the GitHub repo URL.
114
143
  */
115
144
  website?: string;
116
145
  /**
@@ -118,7 +147,13 @@ export interface Manifest {
118
147
  * If the repo is on GitHub and support is not specified, it will default to the GitHub issues URL.
119
148
  */
120
149
  support?: string;
150
+ /**
151
+ * The lowest Firebot version this plugin is compatible with
152
+ */
121
153
  minimumFirebotVersion?: ManifestFirebotVersion;
154
+ /**
155
+ * The highest Firebot version this plugin is compatible with
156
+ */
122
157
  maximumFirebotVersion?: ManifestFirebotVersion;
123
158
  /**
124
159
  * The icon to be displayed for the plugin.
@@ -126,7 +161,13 @@ export interface Manifest {
126
161
  icon?: PluginIcon;
127
162
  }
128
163
  export interface PluginBase<Params extends FirebotParams = FirebotParams> {
164
+ /**
165
+ * Basic information about the plugin
166
+ */
129
167
  manifest: Manifest;
168
+ /**
169
+ * Defines the user-specified parameters for this plugin
170
+ */
130
171
  parametersSchema?: FirebotParameterArray<Params>;
131
172
  }
132
173
  export interface Plugin<Params extends FirebotParams = FirebotParams> extends PluginBase<Params> {
@@ -151,10 +192,11 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Pl
151
192
  uiExtensions?: DynamicArray<UIExtension>;
152
193
  overlayWidgets?: DynamicArray<OverlayWidgetType<any, any>>;
153
194
  httpRoutes?: DynamicObject<PluginHttpRouteDefinition>;
154
- websocketListener?: DynamicObject<CustomWebSocketHandler>;
195
+ websocketListener?: DynamicObject<PluginWebSocketHandler>;
155
196
  webhooks?: DynamicObject<PluginWebhooks>;
156
197
  additionalEffectEvents?: DynamicArray<PluginAdditionalEffectEvents>;
157
198
  additionalVariableEvents?: DynamicArray<PluginAdditionalVariableEvents>;
199
+ additionalFilterEvents?: DynamicArray<PluginAdditionalFilterEvents>;
158
200
  };
159
201
  /** Called when the plugin is loaded */
160
202
  onLoad?: (context: PluginContext<Params>, isInstalling?: boolean) => NoResult;