@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.
Files changed (62) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +43 -0
  3. package/index.d.ts +5 -0
  4. package/index.js +5 -0
  5. package/package.json +44 -0
  6. package/types/accounts.d.ts +13 -0
  7. package/types/auth.d.ts +51 -0
  8. package/types/channel-rewards.d.ts +63 -0
  9. package/types/chat.d.ts +159 -0
  10. package/types/commands.d.ts +138 -0
  11. package/types/counters.d.ts +13 -0
  12. package/types/currency.d.ts +15 -0
  13. package/types/discord.d.ts +10 -0
  14. package/types/effects.d.ts +223 -0
  15. package/types/events.d.ts +99 -0
  16. package/types/expressionish.d.ts +74 -0
  17. package/types/games.d.ts +22 -0
  18. package/types/goals.d.ts +7 -0
  19. package/types/hotkeys.d.ts +12 -0
  20. package/types/icons.d.ts +6 -0
  21. package/types/import.d.ts +69 -0
  22. package/types/index.d.ts +40 -0
  23. package/types/integrations.d.ts +93 -0
  24. package/types/moderation.d.ts +59 -0
  25. package/types/modules/event-manager.d.ts +29 -0
  26. package/types/modules/frontend-communicator.d.ts +53 -0
  27. package/types/modules/index.d.ts +2 -0
  28. package/types/overlay-widgets.d.ts +240 -0
  29. package/types/parameters.d.ts +414 -0
  30. package/types/plugins.d.ts +201 -0
  31. package/types/power-ups.d.ts +20 -0
  32. package/types/pronouns.d.ts +11 -0
  33. package/types/quick-actions.d.ts +18 -0
  34. package/types/quotes.d.ts +17 -0
  35. package/types/ranks.d.ts +23 -0
  36. package/types/restrictions.d.ts +65 -0
  37. package/types/roles.d.ts +21 -0
  38. package/types/script-api.d.ts +95 -0
  39. package/types/settings.d.ts +131 -0
  40. package/types/setups.d.ts +49 -0
  41. package/types/sort-tags.d.ts +4 -0
  42. package/types/timers.d.ts +36 -0
  43. package/types/triggers.d.ts +61 -0
  44. package/types/ui/angular.d.ts +31 -0
  45. package/types/ui/backend-communicator.d.ts +8 -0
  46. package/types/ui/effect-helper-service.d.ts +5 -0
  47. package/types/ui/effect-queues-service.d.ts +10 -0
  48. package/types/ui/firebot-root-scope.d.ts +5 -0
  49. package/types/ui/index.d.ts +12 -0
  50. package/types/ui/modal-factory.d.ts +30 -0
  51. package/types/ui/modal-service.d.ts +21 -0
  52. package/types/ui/ng-toast.d.ts +3 -0
  53. package/types/ui/object-copy-helper.d.ts +9 -0
  54. package/types/ui/platform-service.d.ts +7 -0
  55. package/types/ui/preset-effect-lists-service.d.ts +20 -0
  56. package/types/ui/settings-service.d.ts +5 -0
  57. package/types/util-types.d.ts +52 -0
  58. package/types/variable-macros.d.ts +7 -0
  59. package/types/variables.d.ts +59 -0
  60. package/types/viewers.d.ts +30 -0
  61. package/types/webhooks.d.ts +5 -0
  62. package/types/websocket.d.ts +70 -0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @crowbartools/firebot-types
2
+
3
+ Type definitions and the script API contract for [Firebot](https://firebot.app) custom scripts and plugins.
4
+
5
+ This package is **type-only**. At runtime the `@crowbartools/firebot-types` module is provided by the Firebot host application via a `require()` interceptor — installing this package in a standalone Node project and importing it will throw.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i -D @crowbartools/firebot-types
11
+ ```
12
+
13
+ A `@types/node` peer dependency is required (the script API uses `Buffer` / `BufferEncoding`).
14
+
15
+ ## Usage
16
+
17
+ The default export is the runtime API object provided by Firebot. Named types live under the `@crowbartools/firebot-types/types` subpath.
18
+
19
+ ```ts
20
+ import firebot from "@crowbartools/firebot-types";
21
+ import type { Plugin, EffectScript } from "@crowbartools/firebot-types/types";
22
+
23
+ export const manifest: Plugin["manifest"] = {
24
+ name: "My Plugin",
25
+ version: "1.0.0",
26
+ author: "you",
27
+ description: "Example",
28
+ type: "plugin"
29
+ };
30
+
31
+ export function onLoad() {
32
+ firebot.logger.info(`Running on Firebot ${firebot.version}`);
33
+ }
34
+ ```
35
+
36
+ CommonJS style works too:
37
+
38
+ ```js
39
+ const firebot = require("@crowbartools/firebot-types");
40
+ firebot.logger.info(firebot.version);
41
+ ```
42
+
43
+ The version of this package tracks the Firebot version that produced it.
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ // Auto-generated by grunt publish-types. Do not edit by hand.
2
+ import { FirebotScriptApi } from "./types/script-api";
3
+
4
+ declare const firebot: FirebotScriptApi;
5
+ export = firebot;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // This package is a type-only shim. The real `@crowbartools/firebot-types` module is
2
+ // provided by the Firebot host at runtime via a require() interceptor.
3
+ throw new Error(
4
+ "The '@crowbartools/firebot-types' module is only available when running inside Firebot."
5
+ );
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@crowbartools/firebot-types",
3
+ "version": "5.67.0-alpha1",
4
+ "description": "Type definitions and script API for Firebot custom scripts and plugins.",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "default": "./index.js"
11
+ },
12
+ "./types": {
13
+ "types": "./types/index.d.ts"
14
+ },
15
+ "./types/*": {
16
+ "types": "./types/*.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts",
22
+ "types/**/*.d.ts",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "firebot",
28
+ "twitch",
29
+ "types",
30
+ "script",
31
+ "plugin"
32
+ ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/crowbartools/Firebot.git"
36
+ },
37
+ "homepage": "https://firebot.app",
38
+ "bugs": "https://github.com/crowbartools/Firebot/issues",
39
+ "author": "The Streaming Community",
40
+ "license": "GPL-3.0",
41
+ "peerDependencies": {
42
+ "@types/node": "*"
43
+ }
44
+ }
@@ -0,0 +1,13 @@
1
+ import type { AuthDetails } from "./auth";
2
+
3
+ export type FirebotAccount = {
4
+ username: string;
5
+ displayName?: string;
6
+ description?: string;
7
+ userId?: string;
8
+ channelId?: string;
9
+ avatar?: string;
10
+ broadcasterType?: string;
11
+ auth?: AuthDetails;
12
+ loggedIn?: boolean;
13
+ };
@@ -0,0 +1,51 @@
1
+ import type ClientOAuth2 from "client-oauth2";
2
+
3
+ export interface AuthProviderDefinition {
4
+ id: string;
5
+ name: string;
6
+ client: {
7
+ id: string;
8
+ secret?: string;
9
+ };
10
+ auth: {
11
+ type: "code" | "token" | "device";
12
+ authorizeHost?: string;
13
+ tokenHost: string;
14
+ authorizePath: string;
15
+ tokenPath?: string;
16
+ };
17
+ redirectUriHost?: string;
18
+ scopes?: string[] | string | undefined;
19
+ }
20
+
21
+ export interface AuthProvider {
22
+ id: string;
23
+ oauthClient: ClientOAuth2;
24
+ authorizationUri: string;
25
+ redirectUri: string;
26
+ tokenUri: string;
27
+ details: AuthProviderDefinition;
28
+ }
29
+
30
+ export interface AuthDetails {
31
+ /** The access token */
32
+ access_token: string;
33
+
34
+ /** The type of access token */
35
+ token_type: string;
36
+
37
+ /** OAuth scopes of the access token */
38
+ scope: string[];
39
+
40
+ /** When the token was obtained, in epoch timestamp format */
41
+ obtainment_timestamp?: number;
42
+
43
+ /** How many seconds before the token expires */
44
+ expires_in?: number;
45
+
46
+ /** JSON representation of when access token expires */
47
+ expires_at?: Date;
48
+
49
+ /** The refresh token */
50
+ refresh_token?: string;
51
+ }
@@ -0,0 +1,63 @@
1
+ import type { EffectList } from "./effects";
2
+ import type { RestrictionData } from "./restrictions";
3
+
4
+ export interface CustomRewardImageSet {
5
+ url1x: string;
6
+ url2x: string;
7
+ url4x: string;
8
+ }
9
+
10
+ export interface CustomReward {
11
+ broadcasterId: string;
12
+ broadcasterLogin: string;
13
+ broadcasterName: string;
14
+ id: string;
15
+ title: string;
16
+ prompt: string;
17
+ cost: number;
18
+ image?: CustomRewardImageSet;
19
+ defaultImage: CustomRewardImageSet;
20
+ backgroundColor: string;
21
+ isEnabled: boolean;
22
+ isUserInputRequired: boolean;
23
+ maxPerStreamSetting: {
24
+ isEnabled: boolean;
25
+ maxPerStream: number;
26
+ };
27
+ maxPerUserPerStreamSetting: {
28
+ isEnabled: boolean;
29
+ maxPerUserPerStream: number;
30
+ };
31
+ globalCooldownSetting: {
32
+ isEnabled: boolean;
33
+ globalCooldownSeconds: number;
34
+ };
35
+ isPaused: boolean;
36
+ isInStock: boolean;
37
+ shouldRedemptionsSkipRequestQueue: boolean;
38
+ redemptionsRedeemedCurrentStream?: number;
39
+ cooldownExpiresAt?: Date;
40
+ }
41
+
42
+ export type SavedChannelReward = {
43
+ id: string;
44
+ twitchData: CustomReward;
45
+ manageable: boolean;
46
+ effects?: EffectList;
47
+ effectsFulfilled?: EffectList;
48
+ effectsCanceled?: EffectList;
49
+ restrictionData?: RestrictionData;
50
+ autoApproveRedemptions?: boolean;
51
+ };
52
+
53
+ export type RewardRedemptionMetadata = {
54
+ username: string;
55
+ userId: string;
56
+ userDisplayName: string;
57
+ messageText: string;
58
+ redemptionId: string;
59
+ rewardId: string;
60
+ rewardImage: string;
61
+ rewardName: string;
62
+ rewardCost: number;
63
+ };
@@ -0,0 +1,159 @@
1
+ type FirebotChatMessagePartType =
2
+ | "text"
3
+ | "link"
4
+ | "emote"
5
+ | "third-party-emote"
6
+ | "cheermote"
7
+ | "mention";
8
+
9
+ type FirebotChatMessagePartBase = {
10
+ type: FirebotChatMessagePartType;
11
+ id?: string;
12
+ text: string;
13
+ };
14
+
15
+ type FirebotChatMessageTextPart = FirebotChatMessagePartBase & {
16
+ type: "text";
17
+ flagged?: boolean;
18
+ };
19
+
20
+ type FirebotChatMessageLinkPart = FirebotChatMessagePartBase & {
21
+ type: "link";
22
+ url: string;
23
+ };
24
+
25
+ type FirebotChatMessageEmotePart = FirebotChatMessagePartBase & {
26
+ type: "emote" | "third-party-emote";
27
+ name: string;
28
+ origin: string;
29
+ url: string;
30
+ animatedUrl?: string;
31
+ };
32
+
33
+ type FirebotChatMessageCheermotePart = FirebotChatMessagePartBase & {
34
+ type: "cheermote";
35
+ name: string;
36
+ url: string;
37
+ animatedUrl: string;
38
+ amount: number;
39
+ color: string;
40
+ };
41
+
42
+ type FirebotChatMessageMentionPart = FirebotChatMessagePartBase & {
43
+ type: "mention";
44
+ username: string;
45
+ userId: string;
46
+ userDisplayName: string;
47
+ };
48
+
49
+ export type FirebotChatMessagePart =
50
+ | FirebotChatMessageTextPart
51
+ | FirebotChatMessageLinkPart
52
+ | FirebotChatMessageEmotePart
53
+ | FirebotChatMessageCheermotePart
54
+ | FirebotChatMessageMentionPart;
55
+
56
+ export type FirebotParsedMessagePart = {
57
+ type: string;
58
+ id?: string;
59
+ text?: string;
60
+ name?: string;
61
+ origin?: string;
62
+ position?: number;
63
+ flagged?: boolean;
64
+ length?: number;
65
+ url?: string;
66
+ animatedUrl?: string;
67
+ amount?: number;
68
+ color?: string;
69
+ };
70
+
71
+ export type FirebotChatMessage = {
72
+ id: string;
73
+ timestamp?: number;
74
+ username: string;
75
+ userId: string;
76
+ userDisplayName?: string;
77
+ profilePicUrl?: string;
78
+ pronouns?: string;
79
+ isExtension?: boolean;
80
+ roles: string[];
81
+ badges: Array<{
82
+ title: string;
83
+ url: string;
84
+ }>;
85
+ customRewardId?: string;
86
+ color?: string;
87
+ rawText: string;
88
+ parts: FirebotParsedMessagePart[] | FirebotChatMessagePart[];
89
+ whisper: boolean;
90
+ whisperTarget?: string;
91
+ action: boolean;
92
+ isAnnouncement?: boolean;
93
+ announcementColor?: "PRIMARY" | "BLUE" | "GREEN" | "ORANGE" | "PURPLE";
94
+ tagged: boolean;
95
+ isFounder?: boolean;
96
+ isBroadcaster?: boolean;
97
+ isBot?: boolean;
98
+ isMod?: boolean;
99
+ isSubscriber?: boolean;
100
+ isVip?: boolean;
101
+ isCheer?: boolean;
102
+ isHighlighted?: boolean;
103
+ isAutoModHeld?: boolean;
104
+ autoModStatus?: "pending" | "approved" | "denied" | "expired";
105
+ autoModReason?: string;
106
+ isFirstChat?: boolean;
107
+ isReturningChatter?: boolean;
108
+ isRaider?: boolean;
109
+ raidingFrom?: string;
110
+ isSuspiciousUser?: boolean;
111
+ isReply?: boolean;
112
+ replyParentMessageId?: string;
113
+ replyParentMessageText?: string;
114
+ replyParentMessageSenderUserId?: string;
115
+ replyParentMessageSenderDisplayName?: string;
116
+ threadParentMessageId?: string;
117
+ threadParentMessageSenderUserId?: string;
118
+ threadParentMessageSenderDisplayName?: string;
119
+ isSharedChatMessage: boolean;
120
+ sharedChatRoomId?: string;
121
+ sharedChatRoomUsername?: string;
122
+ sharedChatRoomDisplayName?: string;
123
+ sharedChatRoomProfilePicUrl?: string;
124
+ isHiddenFromChatFeed?: boolean;
125
+ viewerRanks?: Record<string, string>;
126
+ viewerCustomRoles?: string[];
127
+ customHighlightColor?: string;
128
+ customBannerIcon?: string;
129
+ customBannerText?: string;
130
+ reward?: {
131
+ id: string;
132
+ name: string;
133
+ cost: number;
134
+ imageUrl: string;
135
+ };
136
+ isGigantified?: boolean;
137
+ };
138
+
139
+ export type FirebotEmote = {
140
+ url: string;
141
+ animatedUrl: string;
142
+ origin: string;
143
+ code: string;
144
+ };
145
+
146
+ export type FirebotCheermoteInstance = {
147
+ name: string;
148
+ amount: number;
149
+ url: string;
150
+ animatedUrl: string;
151
+ color: string;
152
+ };
153
+
154
+ export type SharedChatParticipant = {
155
+ broadcasterId: string;
156
+ broadcasterName: string;
157
+ broadcasterDisplayName: string;
158
+ profilePictureUrl: string;
159
+ };
@@ -0,0 +1,138 @@
1
+ import type { FirebotChatMessage } from "./chat";
2
+ import type { EffectList } from "./effects";
3
+ import type { RestrictionData } from "./restrictions";
4
+ import type { ParametersConfig } from "./parameters";
5
+ import type { Awaitable } from "./util-types";
6
+
7
+ export type CommandType = "system" | "custom";
8
+
9
+ type Cooldown = {
10
+ /**
11
+ * Global cooldown to use a command in seconds.
12
+ */
13
+ global: number | undefined;
14
+ /**
15
+ * Cooldown for each user to use a command in seconds.
16
+ */
17
+ user: number | undefined;
18
+ };
19
+
20
+ export type SubCommand = {
21
+ arg: string;
22
+ usage: string;
23
+ active?: boolean;
24
+ autoDeleteTrigger?: boolean | undefined;
25
+ id?: string;
26
+ description?: string;
27
+ minArgs?: number;
28
+ regex?: boolean;
29
+ fallback?: boolean;
30
+ restrictionData?: RestrictionData;
31
+ cooldown?: Cooldown | undefined;
32
+ hideCooldowns?: boolean;
33
+ inheritBaseCommandCooldown?: boolean;
34
+ effects?: EffectList;
35
+ hidden?: boolean;
36
+ };
37
+
38
+ export type CommandDefinition<OptionsModel = any> = {
39
+ id?: string;
40
+ name?: string;
41
+ description?: string;
42
+ type?: CommandType;
43
+ createdBy?: string;
44
+ createdAt?: Date | string;
45
+ lastEditBy?: string | undefined;
46
+ lastEditAt?: Date | string | undefined;
47
+ /**
48
+ * Describes how many times the command has been used in chat.
49
+ */
50
+ count?: number;
51
+ active: boolean;
52
+ trigger: string;
53
+ triggerIsRegex?: boolean | undefined;
54
+ scanWholeMessage?: boolean | undefined;
55
+ aliases?: string[];
56
+ usage?: string;
57
+ /**
58
+ * If the chat message that triggered the command should be deleted automatically.
59
+ */
60
+ autoDeleteTrigger?: boolean | undefined;
61
+ /**
62
+ * If the UI should show the edit page in simple or advanced mode.
63
+ */
64
+ simple?: boolean;
65
+ /**
66
+ * If the command should be hidden from the `!commands` list.
67
+ */
68
+ hidden?: boolean | undefined;
69
+ ignoreStreamer?: boolean | undefined;
70
+ ignoreBot?: boolean | undefined;
71
+ ignoreWhispers?: boolean | undefined;
72
+ /**
73
+ * If a chat message should be sent when the command is tried to be used but
74
+ * the cooldown is not yet over.
75
+ */
76
+ sendCooldownMessage?: boolean;
77
+ sendCooldownMessageAsReply?: boolean;
78
+ useCustomCooldownMessage?: boolean;
79
+ cooldownMessage?: string;
80
+ baseCommandDescription?: string | undefined;
81
+ sortTags?: string[];
82
+ cooldown?: Cooldown | undefined;
83
+ effects?: EffectList;
84
+ restrictionData?: RestrictionData;
85
+ subCommands?: SubCommand[] | undefined;
86
+ fallbackSubcommand?: SubCommand | undefined;
87
+ treatQuotedTextAsSingleArg?: boolean | undefined;
88
+ minArgs?: number;
89
+ options?: ParametersConfig<OptionsModel>;
90
+ /**
91
+ * Only set for currency system commands.
92
+ */
93
+ currency?: {
94
+ name: string;
95
+ id: string;
96
+ };
97
+ allowTriggerBySharedChat?: boolean | "inherit" | undefined;
98
+ };
99
+
100
+ type UserCommand = {
101
+ trigger: string;
102
+ args: string[];
103
+ triggeredSubcmd?: SubCommand;
104
+ isInvalidSubcommandTrigger?: boolean;
105
+ triggeredArg?: string;
106
+ subcommandId?: string;
107
+ commandSender: string;
108
+ senderRoles: string[];
109
+ };
110
+
111
+ type BasicCommandDefinition = Omit<
112
+ CommandDefinition,
113
+ | "type"
114
+ | "createdBy"
115
+ | "createdAt"
116
+ | "lastEditBy"
117
+ | "lastEditAt"
118
+ | "count"
119
+ | "simple"
120
+ >;
121
+
122
+ export type SystemCommandDefinition<OptionsModel = any> = CommandDefinition<OptionsModel> & {
123
+ hideCooldowns?: boolean;
124
+ };
125
+
126
+ export type SystemCommand<OptionsModel = any> = {
127
+ definition: SystemCommandDefinition<OptionsModel>;
128
+ onTriggerEvent: (
129
+ event: {
130
+ command: SystemCommand<OptionsModel>['definition'];
131
+ userCommand: UserCommand;
132
+ chatMessage: FirebotChatMessage;
133
+ commandOptions?: {
134
+ [x in keyof OptionsModel]: OptionsModel[x]
135
+ };
136
+ }
137
+ ) => Awaitable<boolean | void>;
138
+ };
@@ -0,0 +1,13 @@
1
+ import type { EffectList } from "./effects";
2
+
3
+ export type Counter = {
4
+ id?: string;
5
+ name: string;
6
+ value: number;
7
+ saveToTxtFile: boolean;
8
+ minimum?: number;
9
+ maximum?: number;
10
+ updateEffects?: EffectList;
11
+ minimumEffects?: EffectList;
12
+ maximumEffects?: EffectList;
13
+ };
@@ -0,0 +1,15 @@
1
+ export type Currency = {
2
+ id: string;
3
+ name: string;
4
+ active: boolean;
5
+ limit: number;
6
+ transfer: "Allow" | "Disallow";
7
+ interval: number;
8
+ payout: number;
9
+
10
+ /** Offline payout */
11
+ offline?: number | string;
12
+
13
+ /** Maps user role IDs to the amount of bonus payout they receive. */
14
+ bonus: Record<string, number>;
15
+ };
@@ -0,0 +1,10 @@
1
+ export type CustomEmbed = {
2
+ title?: string;
3
+ url?: string;
4
+ description?: string;
5
+ authorName?: string;
6
+ authorIconUrl?: string;
7
+ imageUrl?: string;
8
+ };
9
+
10
+ export type EmbedType = "channel" | "stream" | "custom";