@crowbartools/firebot-types 5.67.0-alpha1
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/LICENSE +674 -0
- package/README.md +43 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/package.json +44 -0
- package/types/accounts.d.ts +13 -0
- package/types/auth.d.ts +51 -0
- package/types/channel-rewards.d.ts +63 -0
- package/types/chat.d.ts +159 -0
- package/types/commands.d.ts +138 -0
- package/types/counters.d.ts +13 -0
- package/types/currency.d.ts +15 -0
- package/types/discord.d.ts +10 -0
- package/types/effects.d.ts +223 -0
- package/types/events.d.ts +99 -0
- package/types/expressionish.d.ts +74 -0
- package/types/games.d.ts +22 -0
- package/types/goals.d.ts +7 -0
- package/types/hotkeys.d.ts +12 -0
- package/types/icons.d.ts +6 -0
- package/types/import.d.ts +69 -0
- package/types/index.d.ts +40 -0
- package/types/integrations.d.ts +93 -0
- package/types/moderation.d.ts +59 -0
- package/types/modules/event-manager.d.ts +29 -0
- package/types/modules/frontend-communicator.d.ts +53 -0
- package/types/modules/index.d.ts +2 -0
- package/types/overlay-widgets.d.ts +240 -0
- package/types/parameters.d.ts +414 -0
- package/types/plugins.d.ts +201 -0
- package/types/power-ups.d.ts +20 -0
- package/types/pronouns.d.ts +11 -0
- package/types/quick-actions.d.ts +18 -0
- package/types/quotes.d.ts +17 -0
- package/types/ranks.d.ts +23 -0
- package/types/restrictions.d.ts +65 -0
- package/types/roles.d.ts +21 -0
- package/types/script-api.d.ts +95 -0
- package/types/settings.d.ts +131 -0
- package/types/setups.d.ts +49 -0
- package/types/sort-tags.d.ts +4 -0
- package/types/timers.d.ts +36 -0
- package/types/triggers.d.ts +61 -0
- package/types/ui/angular.d.ts +31 -0
- package/types/ui/backend-communicator.d.ts +8 -0
- package/types/ui/effect-helper-service.d.ts +5 -0
- package/types/ui/effect-queues-service.d.ts +10 -0
- package/types/ui/firebot-root-scope.d.ts +5 -0
- package/types/ui/index.d.ts +12 -0
- package/types/ui/modal-factory.d.ts +30 -0
- package/types/ui/modal-service.d.ts +21 -0
- package/types/ui/ng-toast.d.ts +3 -0
- package/types/ui/object-copy-helper.d.ts +9 -0
- package/types/ui/platform-service.d.ts +7 -0
- package/types/ui/preset-effect-lists-service.d.ts +20 -0
- package/types/ui/settings-service.d.ts +5 -0
- package/types/util-types.d.ts +52 -0
- package/types/variable-macros.d.ts +7 -0
- package/types/variables.d.ts +59 -0
- package/types/viewers.d.ts +30 -0
- package/types/webhooks.d.ts +5 -0
- package/types/websocket.d.ts +70 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import type { EffectList } from "./effects";
|
|
2
|
+
import type { Animation } from "./overlay-widgets";
|
|
3
|
+
|
|
4
|
+
export type BaseParameter = {
|
|
5
|
+
/**
|
|
6
|
+
* The title of the parameter
|
|
7
|
+
* Supports markdown
|
|
8
|
+
*/
|
|
9
|
+
title: string;
|
|
10
|
+
/**
|
|
11
|
+
* The description of the parameter
|
|
12
|
+
* Supports markdown
|
|
13
|
+
*/
|
|
14
|
+
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use `title` and `description` instead
|
|
17
|
+
*/
|
|
18
|
+
secondaryDescription?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Shown under the parameter as muted text
|
|
21
|
+
* Supports markdown
|
|
22
|
+
*/
|
|
23
|
+
tip?: string;
|
|
24
|
+
showBottomHr?: boolean;
|
|
25
|
+
validation?: {
|
|
26
|
+
required?: boolean;
|
|
27
|
+
pattern?: string;
|
|
28
|
+
};
|
|
29
|
+
default?: unknown;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type StringParameter = BaseParameter & {
|
|
33
|
+
type: "string";
|
|
34
|
+
useTextArea?: boolean;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type PasswordParameter = BaseParameter & {
|
|
39
|
+
type: "password";
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type BooleanParameter = BaseParameter & {
|
|
44
|
+
type: "boolean";
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type NumberParameter = BaseParameter & {
|
|
49
|
+
type: "number";
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
default?: number;
|
|
52
|
+
validation?: {
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type DateTimeParameter = BaseParameter & {
|
|
59
|
+
type: "date-time";
|
|
60
|
+
default?: string;
|
|
61
|
+
validation?: {
|
|
62
|
+
futureOnly?: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type EnumParameter<G = string | number> = BaseParameter & {
|
|
67
|
+
type: "enum";
|
|
68
|
+
options: Array<G>;
|
|
69
|
+
default: G | undefined;
|
|
70
|
+
searchable?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Only used if `searchable` is true
|
|
73
|
+
*/
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type FilepathParameter = BaseParameter & {
|
|
78
|
+
type: "filepath";
|
|
79
|
+
fileOptions?: {
|
|
80
|
+
directoryOnly: boolean;
|
|
81
|
+
filters: Array<{
|
|
82
|
+
name: string;
|
|
83
|
+
extensions: string[];
|
|
84
|
+
}>;
|
|
85
|
+
title: string;
|
|
86
|
+
buttonLabel: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type EffectListParameter = BaseParameter & {
|
|
91
|
+
type: "effectlist";
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type DiscordChannelWebhookParameter = BaseParameter & {
|
|
95
|
+
type: "discord-channel-webhooks";
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type CurrencySelectParameter = BaseParameter & {
|
|
99
|
+
type: "currency-select";
|
|
100
|
+
default?: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type ChatterSelectParameter = BaseParameter & {
|
|
104
|
+
type: "chatter-select";
|
|
105
|
+
default?: "Bot" | "Streamer";
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type EditableListParameter = BaseParameter & {
|
|
109
|
+
type: "editable-list";
|
|
110
|
+
default?: string[];
|
|
111
|
+
settings: {
|
|
112
|
+
useTextArea: boolean;
|
|
113
|
+
sortable: boolean;
|
|
114
|
+
addLabel: string;
|
|
115
|
+
editLabel: string;
|
|
116
|
+
noneAddedText: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type MultiselectParameter<
|
|
121
|
+
T extends string | number = string | number
|
|
122
|
+
> = BaseParameter & {
|
|
123
|
+
type: "multiselect";
|
|
124
|
+
default?: T[];
|
|
125
|
+
settings: {
|
|
126
|
+
options: Array<{
|
|
127
|
+
id: T;
|
|
128
|
+
name: string;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export type RolePercentageParameterValue = {
|
|
134
|
+
basePercent: number;
|
|
135
|
+
roles: Array<{
|
|
136
|
+
roleId: string;
|
|
137
|
+
percent: number;
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export type RolePercentagesParameter = BaseParameter & {
|
|
142
|
+
type: "role-percentages";
|
|
143
|
+
default?: RolePercentageParameterValue;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type RoleNumberParameterValue = {
|
|
147
|
+
base: number;
|
|
148
|
+
roles: Array<{
|
|
149
|
+
roleId: string;
|
|
150
|
+
value: number;
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type RoleNumberParameter = BaseParameter & {
|
|
155
|
+
type: "role-numbers";
|
|
156
|
+
default?: RoleNumberParameterValue;
|
|
157
|
+
settings: {
|
|
158
|
+
defaultBase: number;
|
|
159
|
+
defaultOther: number;
|
|
160
|
+
min?: number;
|
|
161
|
+
max?: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type ButtonParameter = BaseParameter & {
|
|
166
|
+
type: "button";
|
|
167
|
+
/**
|
|
168
|
+
* The event name that will be sent to the backend when the button is clicked
|
|
169
|
+
*/
|
|
170
|
+
backendEventName: string;
|
|
171
|
+
buttonText: string;
|
|
172
|
+
size?: "extraSmall" | "small" | "large";
|
|
173
|
+
buttonType?:
|
|
174
|
+
| "default"
|
|
175
|
+
| "primary"
|
|
176
|
+
| "success"
|
|
177
|
+
| "info"
|
|
178
|
+
| "warning"
|
|
179
|
+
| "danger"
|
|
180
|
+
| "link";
|
|
181
|
+
tooltip?: string;
|
|
182
|
+
tooltipPlacement?:
|
|
183
|
+
| "top"
|
|
184
|
+
| "top-left"
|
|
185
|
+
| "top-right"
|
|
186
|
+
| "bottom"
|
|
187
|
+
| "bottom-left"
|
|
188
|
+
| "bottom-right"
|
|
189
|
+
| "left"
|
|
190
|
+
| "left-top"
|
|
191
|
+
| "left-bottom"
|
|
192
|
+
| "right"
|
|
193
|
+
| "right-top"
|
|
194
|
+
| "right-bottom";
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type HexColorParameter = BaseParameter & {
|
|
198
|
+
type: "hexcolor";
|
|
199
|
+
/**
|
|
200
|
+
* Default hex color value, e.g. #FF0000
|
|
201
|
+
*/
|
|
202
|
+
default: string;
|
|
203
|
+
allowAlpha?: boolean;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export type FontNameParameter = BaseParameter & {
|
|
207
|
+
type: "font-name";
|
|
208
|
+
/**
|
|
209
|
+
* Default font name value, e.g. 'Arial'
|
|
210
|
+
*/
|
|
211
|
+
default?: string;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type FontOptions = {
|
|
215
|
+
family: string;
|
|
216
|
+
size: number;
|
|
217
|
+
weight: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
218
|
+
italic: boolean;
|
|
219
|
+
color?: string;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type FontOptionsParameter = BaseParameter & {
|
|
223
|
+
type: "font-options";
|
|
224
|
+
default: FontOptions;
|
|
225
|
+
allowAlpha?: boolean;
|
|
226
|
+
hideColor?: boolean;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type RadioCardsParameter<V = string> = BaseParameter & {
|
|
230
|
+
type: "radio-cards";
|
|
231
|
+
default?: V;
|
|
232
|
+
options: Array<{
|
|
233
|
+
value: V;
|
|
234
|
+
label: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
iconClass?: string;
|
|
237
|
+
}>;
|
|
238
|
+
settings?: {
|
|
239
|
+
gridColumns?: number;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export type CodeMirrorParameter = BaseParameter & {
|
|
244
|
+
type: "codemirror";
|
|
245
|
+
default?: string;
|
|
246
|
+
settings?: {
|
|
247
|
+
mode: { name: "javascript", json?: boolean } | "htmlmixed" | "css" | { mode: "xml", htmlMode: true };
|
|
248
|
+
theme: 'blackboard';
|
|
249
|
+
lineNumbers?: boolean;
|
|
250
|
+
autoRefresh?: boolean;
|
|
251
|
+
showGutter?: boolean;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export type CounterSelectParameter = BaseParameter & {
|
|
256
|
+
type: "counter-select";
|
|
257
|
+
default?: never;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export type SortTagSelectParameter = BaseParameter & {
|
|
261
|
+
type: "sort-tag-select";
|
|
262
|
+
context: string;
|
|
263
|
+
default?: never;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export type AnimationSelectParameter = BaseParameter & {
|
|
267
|
+
type: "animation-select";
|
|
268
|
+
animationType: "enter" | "exit" | "inbetween";
|
|
269
|
+
default?: Animation;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export type UnknownParameter = BaseParameter & {
|
|
273
|
+
[key: string]: unknown;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
type FirebotParameter =
|
|
277
|
+
| StringParameter
|
|
278
|
+
| PasswordParameter
|
|
279
|
+
| BooleanParameter
|
|
280
|
+
| NumberParameter
|
|
281
|
+
| DateTimeParameter
|
|
282
|
+
| EnumParameter
|
|
283
|
+
| EffectListParameter
|
|
284
|
+
| DiscordChannelWebhookParameter
|
|
285
|
+
| CurrencySelectParameter
|
|
286
|
+
| ChatterSelectParameter
|
|
287
|
+
| EditableListParameter
|
|
288
|
+
| MultiselectParameter
|
|
289
|
+
| RolePercentagesParameter
|
|
290
|
+
| RoleNumberParameter
|
|
291
|
+
| ButtonParameter
|
|
292
|
+
| UnknownParameter
|
|
293
|
+
| HexColorParameter
|
|
294
|
+
| FontNameParameter
|
|
295
|
+
| FontOptionsParameter
|
|
296
|
+
| RadioCardsParameter
|
|
297
|
+
| CodeMirrorParameter
|
|
298
|
+
| CounterSelectParameter
|
|
299
|
+
| SortTagSelectParameter
|
|
300
|
+
| AnimationSelectParameter;
|
|
301
|
+
|
|
302
|
+
export type ParametersConfig<P> = {
|
|
303
|
+
[K in keyof P]: (P[K] extends string
|
|
304
|
+
?
|
|
305
|
+
| StringParameter
|
|
306
|
+
| PasswordParameter
|
|
307
|
+
| DateTimeParameter
|
|
308
|
+
| FilepathParameter
|
|
309
|
+
| ChatterSelectParameter
|
|
310
|
+
| CurrencySelectParameter
|
|
311
|
+
| EnumParameter<string>
|
|
312
|
+
| HexColorParameter
|
|
313
|
+
| FontNameParameter
|
|
314
|
+
| RadioCardsParameter<string>
|
|
315
|
+
| CodeMirrorParameter
|
|
316
|
+
| CounterSelectParameter
|
|
317
|
+
| SortTagSelectParameter
|
|
318
|
+
: P[K] extends number
|
|
319
|
+
? NumberParameter | EnumParameter<number>
|
|
320
|
+
: P[K] extends boolean
|
|
321
|
+
? BooleanParameter | EnumParameter<boolean>
|
|
322
|
+
: P[K] extends Array<string>
|
|
323
|
+
? MultiselectParameter<string> | EditableListParameter
|
|
324
|
+
: P[K] extends Array<number>
|
|
325
|
+
? MultiselectParameter<number>
|
|
326
|
+
: P[K] extends void | undefined | null
|
|
327
|
+
? ButtonParameter
|
|
328
|
+
: P[K] extends RolePercentageParameterValue
|
|
329
|
+
? RolePercentagesParameter
|
|
330
|
+
: P[K] extends RoleNumberParameterValue
|
|
331
|
+
? RoleNumberParameter
|
|
332
|
+
: P[K] extends EffectList
|
|
333
|
+
? EffectListParameter
|
|
334
|
+
: P[K] extends FontOptions
|
|
335
|
+
? FontOptionsParameter
|
|
336
|
+
: P[K] extends Animation
|
|
337
|
+
? AnimationSelectParameter : FirebotParameter) & { value?: P[K] };
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export type ParametersWithNameConfig<P> = {
|
|
341
|
+
[K in keyof P]: (P[K] extends string
|
|
342
|
+
?
|
|
343
|
+
| StringParameter
|
|
344
|
+
| PasswordParameter
|
|
345
|
+
| DateTimeParameter
|
|
346
|
+
| FilepathParameter
|
|
347
|
+
| ChatterSelectParameter
|
|
348
|
+
| CurrencySelectParameter
|
|
349
|
+
| EnumParameter<string>
|
|
350
|
+
| HexColorParameter
|
|
351
|
+
| FontNameParameter
|
|
352
|
+
| RadioCardsParameter<string>
|
|
353
|
+
| CodeMirrorParameter
|
|
354
|
+
| CounterSelectParameter
|
|
355
|
+
| SortTagSelectParameter
|
|
356
|
+
: P[K] extends number
|
|
357
|
+
? NumberParameter | EnumParameter<number> | RadioCardsParameter<number>
|
|
358
|
+
: P[K] extends boolean
|
|
359
|
+
? BooleanParameter | EnumParameter<boolean> | RadioCardsParameter<boolean>
|
|
360
|
+
: P[K] extends Array<string>
|
|
361
|
+
? MultiselectParameter<string> | EditableListParameter
|
|
362
|
+
: P[K] extends Array<number>
|
|
363
|
+
? MultiselectParameter<number>
|
|
364
|
+
: P[K] extends void | undefined | null
|
|
365
|
+
? ButtonParameter
|
|
366
|
+
: P[K] extends RolePercentageParameterValue
|
|
367
|
+
? RolePercentagesParameter
|
|
368
|
+
: P[K] extends RoleNumberParameterValue
|
|
369
|
+
? RoleNumberParameter
|
|
370
|
+
: P[K] extends EffectList
|
|
371
|
+
? EffectListParameter
|
|
372
|
+
: P[K] extends FontOptions
|
|
373
|
+
? FontOptionsParameter
|
|
374
|
+
: P[K] extends Animation
|
|
375
|
+
? AnimationSelectParameter : FirebotParameter) & { name: K, showIf?: { [K2 in keyof P]?: P[K2] | Array<P[K2]> } };
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
type FirebotParamCategory<ParamConfig extends Record<string, unknown>> = {
|
|
379
|
+
title: string;
|
|
380
|
+
/**
|
|
381
|
+
* Used to order categories in the UI.
|
|
382
|
+
*/
|
|
383
|
+
sortRank?: number;
|
|
384
|
+
settings: ParametersConfig<ParamConfig>;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export type FirebotParams = Record<string, Record<string, unknown>>;
|
|
388
|
+
|
|
389
|
+
export type FirebotParameterCategories<Config extends FirebotParams> = {
|
|
390
|
+
[Category in keyof Config]: FirebotParamCategory<Config[Category]>;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export type FirebotParameterArray<Config extends Record<string, unknown>> = ParametersWithNameConfig<Config>[keyof Config][];
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
// export type WithValues<Categories extends FirebotParameterCategories> = {
|
|
397
|
+
// [Category in keyof Categories]: Categories[Category] & {
|
|
398
|
+
// settings: {
|
|
399
|
+
// [Setting in keyof Categories[Category]["settings"]]: Categories[Category]["settings"][Setting] & {
|
|
400
|
+
// value?: Categories[Category]["settings"][Setting]["default"];
|
|
401
|
+
// };
|
|
402
|
+
// };
|
|
403
|
+
// }
|
|
404
|
+
// };
|
|
405
|
+
|
|
406
|
+
// type ValidParamKeys<T> = {
|
|
407
|
+
// [P in keyof T]: Exclude<T[P], undefined> extends void | undefined | null
|
|
408
|
+
// ? never
|
|
409
|
+
// : P;
|
|
410
|
+
// }[keyof T];
|
|
411
|
+
|
|
412
|
+
// export type ResolvedParameters<Config extends FirebotParams> = {
|
|
413
|
+
// [K in keyof Config]: Pick<Config[K], ValidParamKeys<Config[K]>>;
|
|
414
|
+
// }
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { EffectInstance, EffectList, EffectType } from "./effects";
|
|
2
|
+
import { Trigger } from "./triggers";
|
|
3
|
+
import { Awaitable } from "./util-types";
|
|
4
|
+
import { ReplaceVariable } from "./variables";
|
|
5
|
+
import { EventFilter, EventSource } from "./events";
|
|
6
|
+
import { SystemCommand } from "./commands";
|
|
7
|
+
import { RestrictionType } from "./restrictions";
|
|
8
|
+
import { FirebotParams, FirebotParameterArray } from "./parameters";
|
|
9
|
+
import { FirebotGame } from "./games";
|
|
10
|
+
import { Integration } from "./integrations";
|
|
11
|
+
|
|
12
|
+
type NoResult = Awaitable<void>;
|
|
13
|
+
|
|
14
|
+
type GenericParameters = Record<string, unknown>;
|
|
15
|
+
|
|
16
|
+
export type InstalledPluginConfig<Params extends GenericParameters = GenericParameters> = {
|
|
17
|
+
id: string;
|
|
18
|
+
fileName: string;
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
legacyImport?: boolean;
|
|
21
|
+
parameters: Params;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ScriptContext = {
|
|
25
|
+
trigger?: Trigger;
|
|
26
|
+
parameters: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type DynamicArray<T> = Array<T | ((context: ScriptContext) => Awaitable<T>)>;
|
|
30
|
+
|
|
31
|
+
export type ScriptType = "script" | "plugin";
|
|
32
|
+
|
|
33
|
+
interface ManifestDescription {
|
|
34
|
+
short: string;
|
|
35
|
+
long?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ManifestFirebotVersion {
|
|
39
|
+
major: number;
|
|
40
|
+
minor?: number;
|
|
41
|
+
patch?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Manifest {
|
|
45
|
+
name: string;
|
|
46
|
+
version: string;
|
|
47
|
+
author: string;
|
|
48
|
+
description: string | ManifestDescription;
|
|
49
|
+
|
|
50
|
+
keywords?: string[];
|
|
51
|
+
|
|
52
|
+
repo?: string;
|
|
53
|
+
|
|
54
|
+
// Note: autofilled if repo is assumed github and not specified
|
|
55
|
+
website?: string;
|
|
56
|
+
report?: string;
|
|
57
|
+
source?: string;
|
|
58
|
+
|
|
59
|
+
minimumFirebotVersion?: ManifestFirebotVersion;
|
|
60
|
+
maximumFirebotVersion?: ManifestFirebotVersion;
|
|
61
|
+
|
|
62
|
+
icon?: `fa-${string}`;
|
|
63
|
+
color?: string;
|
|
64
|
+
|
|
65
|
+
type: ScriptType;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type EffectScriptResult = {
|
|
69
|
+
success: boolean;
|
|
70
|
+
errorMessage?: string;
|
|
71
|
+
effects?: EffectList | Array<EffectInstance>;
|
|
72
|
+
onEffectsDone?: () => Awaitable<void>;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export interface ScriptBase<Params extends FirebotParams = FirebotParams> {
|
|
77
|
+
manifest: Manifest;
|
|
78
|
+
|
|
79
|
+
parametersSchema?: FirebotParameterArray<Params>;
|
|
80
|
+
|
|
81
|
+
// if uninstalled is true, the script is being removed by the user, thus the script should remove related data files/assets
|
|
82
|
+
// otherwise the script should assume firebot is closing or the script is being reloaded
|
|
83
|
+
onUnload?: (context: ScriptContext, isUninstalling?: boolean) => NoResult;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Supplants the "Run Script" effect script functionality
|
|
87
|
+
export interface EffectScript<Params extends FirebotParams = FirebotParams> extends ScriptBase<Params> {
|
|
88
|
+
run: (context: ScriptContext) => Awaitable<void | EffectScriptResult>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Supplants the "Start up" script functionality
|
|
92
|
+
export interface Plugin<Params extends FirebotParams = FirebotParams> extends ScriptBase<Params> {
|
|
93
|
+
// Note: At least one is required: onLoad or registers.*
|
|
94
|
+
// if not met, the script will not be loaded and it should be logged the script does nothing
|
|
95
|
+
|
|
96
|
+
// Automatically handles registration with appropriate managers for definitions
|
|
97
|
+
// when the script is unloaded, definitions will automagically be unregistered
|
|
98
|
+
registers?: {
|
|
99
|
+
|
|
100
|
+
// If value within array is a function, call said function to get definition
|
|
101
|
+
// If definition is or evaluates to promise, await promise
|
|
102
|
+
effects?: DynamicArray<EffectType>;
|
|
103
|
+
eventSources?: DynamicArray<EventSource>;
|
|
104
|
+
variables?: DynamicArray<ReplaceVariable>;
|
|
105
|
+
// endpoints?: DynamicArray<HttpEndpoint>;
|
|
106
|
+
integrations?: DynamicArray<Integration>;
|
|
107
|
+
filters?: DynamicArray<EventFilter>;
|
|
108
|
+
restrictions?: DynamicArray<RestrictionType>;
|
|
109
|
+
systemCommands?: DynamicArray<SystemCommand>;
|
|
110
|
+
games?: DynamicArray<FirebotGame>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Called when the script is loaded
|
|
114
|
+
onLoad?: (context: ScriptContext, isInstalling?: boolean) => NoResult;
|
|
115
|
+
|
|
116
|
+
// Called when firebot is closing or plugin is disabled / removed
|
|
117
|
+
onUnload?: (context: ScriptContext, isUninstalling?: boolean) => NoResult;
|
|
118
|
+
|
|
119
|
+
// called when the user updates plugin-specific parameters
|
|
120
|
+
onParameterUpdate?: (context: ScriptContext) => NoResult;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type ScriptDetails = Pick<ScriptBase, "manifest" | "parametersSchema">;
|
|
124
|
+
|
|
125
|
+
export type InstalledPlugin = {
|
|
126
|
+
config: InstalledPluginConfig;
|
|
127
|
+
details: ScriptDetails;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/* Legacy types */
|
|
131
|
+
|
|
132
|
+
type LegacyScriptParameters = Record<
|
|
133
|
+
string,
|
|
134
|
+
{
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
136
|
+
type: any;
|
|
137
|
+
title?: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
secondaryDescription?: string;
|
|
140
|
+
tip?: string;
|
|
141
|
+
showBottomHr?: boolean;
|
|
142
|
+
validation?: {
|
|
143
|
+
required?: boolean;
|
|
144
|
+
};
|
|
145
|
+
value?: unknown;
|
|
146
|
+
default?: unknown;
|
|
147
|
+
}
|
|
148
|
+
>;
|
|
149
|
+
|
|
150
|
+
export type LegacyScriptReturnObject = {
|
|
151
|
+
success: boolean;
|
|
152
|
+
errorMessage?: string;
|
|
153
|
+
effects: unknown[] | { id: string, list: unknown[] };
|
|
154
|
+
callback?: VoidFunction;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
type LegacyRunRequest = {
|
|
158
|
+
parameters: Record<string, unknown>;
|
|
159
|
+
modules: Record<string, unknown>;
|
|
160
|
+
firebot: {
|
|
161
|
+
accounts: {
|
|
162
|
+
streamer: unknown;
|
|
163
|
+
bot: unknown;
|
|
164
|
+
};
|
|
165
|
+
settings: {
|
|
166
|
+
webServerPort: number;
|
|
167
|
+
};
|
|
168
|
+
version: string;
|
|
169
|
+
};
|
|
170
|
+
trigger: Trigger;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
type LegacyCustomScriptManifest = {
|
|
174
|
+
name: string;
|
|
175
|
+
description: string;
|
|
176
|
+
version: string;
|
|
177
|
+
author: string;
|
|
178
|
+
website?: string;
|
|
179
|
+
startupOnly?: boolean;
|
|
180
|
+
firebotVersion?: "5";
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type LegacyScriptData = {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
scriptName: string;
|
|
187
|
+
parameters: LegacyScriptParameters;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export type LegacyCustomScript = {
|
|
191
|
+
getScriptManifest(): Awaitable<LegacyCustomScriptManifest>;
|
|
192
|
+
getDefaultParameters?: () => LegacyScriptParameters;
|
|
193
|
+
run(
|
|
194
|
+
runRequest: LegacyRunRequest
|
|
195
|
+
): Awaitable<void | LegacyScriptReturnObject>;
|
|
196
|
+
parametersUpdated?: (parameters: Record<string, unknown>) => Awaitable<void>;
|
|
197
|
+
stop?: () => Awaitable<void>;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type FirebotScriptApi = import("./script-api").FirebotScriptApi;
|
|
201
|
+
export type { ScriptLoggerApi, ScriptWebhooksApi, ScriptWebhook, ScriptWebhookEvent } from "./script-api";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CustomPowerUp } from "../backend/streaming-platforms/twitch/api/resource/power-ups";
|
|
2
|
+
import type { EffectList } from "./effects";
|
|
3
|
+
|
|
4
|
+
export type SavedPowerUp = {
|
|
5
|
+
id: string;
|
|
6
|
+
twitchData: CustomPowerUp;
|
|
7
|
+
effects?: EffectList;
|
|
8
|
+
sortTags?: string[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type PowerUpRedemptionMetadata = {
|
|
12
|
+
username: string;
|
|
13
|
+
userId: string;
|
|
14
|
+
userDisplayName: string;
|
|
15
|
+
messageText: string;
|
|
16
|
+
powerUpId: string;
|
|
17
|
+
powerUpImage: string;
|
|
18
|
+
powerUpName: string;
|
|
19
|
+
bits: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EffectList } from "./effects";
|
|
2
|
+
import type { Awaitable } from "./util-types";
|
|
3
|
+
|
|
4
|
+
export type QuickActionDefinition = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: "system" | "custom";
|
|
8
|
+
icon: string;
|
|
9
|
+
presetListId?: string;
|
|
10
|
+
presetArgValues?: Record<string, unknown>;
|
|
11
|
+
promptForArgs?: boolean;
|
|
12
|
+
effectList?: EffectList;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type SystemQuickAction = {
|
|
16
|
+
definition: QuickActionDefinition;
|
|
17
|
+
onTriggerEvent(): Awaitable<void>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type QuoteAutoid = {
|
|
2
|
+
_id: "__autoid__";
|
|
3
|
+
seq: number;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type Quote = {
|
|
7
|
+
_id?: number;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
creator: string;
|
|
10
|
+
game: string;
|
|
11
|
+
originator: string;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type FormattedQuote = Omit<Quote, "_id"> & {
|
|
16
|
+
id: number;
|
|
17
|
+
};
|
package/types/ranks.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Rank = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
value?: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type RankLadder = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
mode: "manual" | "auto";
|
|
11
|
+
settings: {
|
|
12
|
+
trackBy?: "view_time" | "currency" | "metadata";
|
|
13
|
+
currencyId?: string;
|
|
14
|
+
metadataKey?: string;
|
|
15
|
+
viewerRestrictions?: {
|
|
16
|
+
roleIds?: string[];
|
|
17
|
+
};
|
|
18
|
+
announcePromotionsInChat?: boolean;
|
|
19
|
+
customPromotionMessageTemplate?: string;
|
|
20
|
+
showBadgeInChat?: boolean;
|
|
21
|
+
};
|
|
22
|
+
ranks: Rank[];
|
|
23
|
+
};
|