@tixyel/streamelements 6.4.8 → 6.5.0
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/dist/index.d.ts +132 -114
- package/dist/index.es.js +761 -753
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1622,86 +1622,16 @@ type BttvEmote = {
|
|
|
1622
1622
|
height: number;
|
|
1623
1623
|
};
|
|
1624
1624
|
};
|
|
1625
|
-
type
|
|
1626
|
-
|
|
1627
|
-
interface ButtonOptions {
|
|
1628
|
-
field: string | ((field: string, value: string | boolean | number) => boolean);
|
|
1629
|
-
template?: string;
|
|
1630
|
-
name?: string;
|
|
1631
|
-
value?: string;
|
|
1632
|
-
run: (field: string, value: string | boolean | number) => void;
|
|
1633
|
-
}
|
|
1634
|
-
/**
|
|
1635
|
-
* Represents a button action that can be triggered by custom fields in StreamElements.
|
|
1636
|
-
* The button can be configured with a template and a name, and it will execute a specified function when triggered.
|
|
1637
|
-
* @example
|
|
1638
|
-
* ```javascript
|
|
1639
|
-
* const button = new Button({
|
|
1640
|
-
* field: (field, value) => field.startsWith('message-') && field.split('-')[1],
|
|
1641
|
-
* template: 'message-{role}',
|
|
1642
|
-
* // name: '[CAP={role}] role message',
|
|
1643
|
-
* name: 'Generate {role} message',
|
|
1644
|
-
* run(field, value) {
|
|
1645
|
-
* console.log(`Button ${field} was clicked with value: ${value}`);
|
|
1646
|
-
* }
|
|
1647
|
-
* })
|
|
1648
|
-
*
|
|
1649
|
-
* const field = button.generate([{ role: 'broadcaster' }, { role: 'moderator' }]);
|
|
1650
|
-
* // This will create buttons with fields "message-broadcaster" and "message-moderator" and names "Generate broadcaster message" and "Generate moderator message".
|
|
1651
|
-
* // field['message-broadcaster'] => { type: 'button', label: 'Generate broadcaster message' }
|
|
1652
|
-
* // field['message-moderator'] => { type: 'button', label: 'Generate moderator message' }
|
|
1653
|
-
*
|
|
1654
|
-
* // When a custom field with the name "message-broadcaster" or "message-moderator" is triggered, the run function will be called with the field and value.
|
|
1655
|
-
* ```
|
|
1656
|
-
*/
|
|
1657
|
-
declare class Button {
|
|
1658
|
-
field: ButtonOptions['field'];
|
|
1659
|
-
template: string;
|
|
1625
|
+
type Emoji = {
|
|
1626
|
+
type: 'emoji';
|
|
1660
1627
|
name: string;
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
interface Theme {
|
|
1671
|
-
color?: string;
|
|
1672
|
-
background?: string;
|
|
1673
|
-
bold?: boolean;
|
|
1674
|
-
italic?: boolean;
|
|
1675
|
-
fontSize?: number;
|
|
1676
|
-
icon?: string;
|
|
1677
|
-
}
|
|
1678
|
-
interface Options {
|
|
1679
|
-
enabled?: boolean;
|
|
1680
|
-
prefix?: string | (() => string);
|
|
1681
|
-
}
|
|
1682
|
-
type LogMethod = (...args: unknown[]) => void;
|
|
1683
|
-
declare class useLogger {
|
|
1684
|
-
enabled: boolean;
|
|
1685
|
-
prefix: string | (() => string);
|
|
1686
|
-
constructor(options?: Options);
|
|
1687
|
-
apply(theme: Theme): LogMethod;
|
|
1688
|
-
private style;
|
|
1689
|
-
group(label: string): void;
|
|
1690
|
-
groupCollapsed(label: string): void;
|
|
1691
|
-
groupEnd(): void;
|
|
1692
|
-
table(data: unknown): void;
|
|
1693
|
-
time(label: string): void;
|
|
1694
|
-
timeEnd(label: string): void;
|
|
1695
|
-
readonly error: LogMethod;
|
|
1696
|
-
readonly warn: LogMethod;
|
|
1697
|
-
readonly success: LogMethod;
|
|
1698
|
-
readonly info: LogMethod;
|
|
1699
|
-
readonly debug: LogMethod;
|
|
1700
|
-
readonly alert: LogMethod;
|
|
1701
|
-
readonly status: LogMethod;
|
|
1702
|
-
readonly received: LogMethod;
|
|
1703
|
-
readonly simple: LogMethod;
|
|
1704
|
-
}
|
|
1628
|
+
id: string;
|
|
1629
|
+
gif: boolean;
|
|
1630
|
+
urls: {
|
|
1631
|
+
'1': string;
|
|
1632
|
+
};
|
|
1633
|
+
};
|
|
1634
|
+
type Emote = TwitchEmote | BttvEmote | SeventvEmote | Emoji;
|
|
1705
1635
|
|
|
1706
1636
|
/**
|
|
1707
1637
|
* EventProvider class for managing event listeners and emitters.
|
|
@@ -1814,6 +1744,44 @@ declare class useStorage<T extends JSONObject> extends EventProvider<UseStorageE
|
|
|
1814
1744
|
on<K extends keyof UseStorageEvents<T>>(eventName: K, callback: (this: useStorage<T>, ...args: UseStorageEvents<T>[K]) => void): this;
|
|
1815
1745
|
}
|
|
1816
1746
|
|
|
1747
|
+
interface CommandOptions {
|
|
1748
|
+
prefix?: string;
|
|
1749
|
+
name: string;
|
|
1750
|
+
description?: string;
|
|
1751
|
+
arguments?: boolean;
|
|
1752
|
+
run: (this: Client, args: string[], event: CommandEvent) => void;
|
|
1753
|
+
test?: string;
|
|
1754
|
+
aliases?: string[];
|
|
1755
|
+
permissions?: string[] | boolean;
|
|
1756
|
+
admins?: string[];
|
|
1757
|
+
}
|
|
1758
|
+
type CommandEvent = {
|
|
1759
|
+
provider: 'twitch';
|
|
1760
|
+
data: StreamElements.Event.Provider.Twitch.Message;
|
|
1761
|
+
} | {
|
|
1762
|
+
provider: 'youtube';
|
|
1763
|
+
data: StreamElements.Event.Provider.YouTube.Message;
|
|
1764
|
+
} | {
|
|
1765
|
+
provider: 'kick';
|
|
1766
|
+
data: any;
|
|
1767
|
+
};
|
|
1768
|
+
declare class Command {
|
|
1769
|
+
prefix: string;
|
|
1770
|
+
name: string;
|
|
1771
|
+
description: string;
|
|
1772
|
+
arguments: boolean;
|
|
1773
|
+
test: string | (() => string);
|
|
1774
|
+
aliases: string[];
|
|
1775
|
+
permissions?: string[] | boolean;
|
|
1776
|
+
admins: string[];
|
|
1777
|
+
constructor(options: CommandOptions);
|
|
1778
|
+
run(this: Client | undefined, args: string[], event: CommandEvent): void;
|
|
1779
|
+
verify(nickname: string, roles: string[], args: string[]): boolean;
|
|
1780
|
+
parse(text: string, event: CommandEvent): boolean;
|
|
1781
|
+
remove(): void;
|
|
1782
|
+
static execute(received: CommandEvent): boolean;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1817
1785
|
declare namespace Alejo {
|
|
1818
1786
|
namespace Pronouns {
|
|
1819
1787
|
type name = 'hehim' | 'sheher' | 'theythem' | 'shethem' | 'hethem' | 'heshe' | 'xexem' | 'faefaer' | 'vever' | 'aeaer' | 'ziehir' | 'perper' | 'eem' | 'itits';
|
|
@@ -1900,42 +1868,83 @@ declare class Client extends EventProvider<ClientEvents> {
|
|
|
1900
1868
|
on<K extends keyof ClientEvents>(eventName: K, callback: (this: Client, ...args: ClientEvents[K]) => void): this;
|
|
1901
1869
|
}
|
|
1902
1870
|
|
|
1903
|
-
interface
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
run: (this: Client,
|
|
1909
|
-
test?: string;
|
|
1910
|
-
aliases?: string[];
|
|
1911
|
-
permissions?: string[] | boolean;
|
|
1912
|
-
admins?: string[];
|
|
1871
|
+
interface ButtonOptions {
|
|
1872
|
+
field: string | ((field: string, value: string | boolean | number) => boolean);
|
|
1873
|
+
template?: string;
|
|
1874
|
+
name?: string;
|
|
1875
|
+
value?: string;
|
|
1876
|
+
run: (this: Client | undefined, field: string, value: string | boolean | number) => void;
|
|
1913
1877
|
}
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1878
|
+
/**
|
|
1879
|
+
* Represents a button action that can be triggered by custom fields in StreamElements.
|
|
1880
|
+
* The button can be configured with a template and a name, and it will execute a specified function when triggered.
|
|
1881
|
+
* @example
|
|
1882
|
+
* ```javascript
|
|
1883
|
+
* const button = new Button({
|
|
1884
|
+
* field: (field, value) => field.startsWith('message-') && field.split('-')[1],
|
|
1885
|
+
* template: 'message-{role}',
|
|
1886
|
+
* // name: '[CAP={role}] role message',
|
|
1887
|
+
* name: 'Generate {role} message',
|
|
1888
|
+
* run(field, value) {
|
|
1889
|
+
* console.log(`Button ${field} was clicked with value: ${value}`);
|
|
1890
|
+
* }
|
|
1891
|
+
* })
|
|
1892
|
+
*
|
|
1893
|
+
* const field = button.generate([{ role: 'broadcaster' }, { role: 'moderator' }]);
|
|
1894
|
+
* // This will create buttons with fields "message-broadcaster" and "message-moderator" and names "Generate broadcaster message" and "Generate moderator message".
|
|
1895
|
+
* // field['message-broadcaster'] => { type: 'button', label: 'Generate broadcaster message' }
|
|
1896
|
+
* // field['message-moderator'] => { type: 'button', label: 'Generate moderator message' }
|
|
1897
|
+
*
|
|
1898
|
+
* // When a custom field with the name "message-broadcaster" or "message-moderator" is triggered, the run function will be called with the field and value.
|
|
1899
|
+
* ```
|
|
1900
|
+
*/
|
|
1901
|
+
declare class Button {
|
|
1902
|
+
field: ButtonOptions['field'];
|
|
1903
|
+
template: string;
|
|
1926
1904
|
name: string;
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
admins: string[];
|
|
1933
|
-
constructor(options: CommandOptions);
|
|
1934
|
-
run(this: Client, args: string[], event: CommandEvent): void;
|
|
1935
|
-
verify(nickname: string, roles: string[], args: string[]): boolean;
|
|
1936
|
-
parse(text: string, event: CommandEvent): boolean;
|
|
1905
|
+
value: string;
|
|
1906
|
+
run: ButtonOptions['run'];
|
|
1907
|
+
constructor(options: ButtonOptions);
|
|
1908
|
+
generate(values: Array<Record<string, string | number>>): Record<string, StreamElements.CustomField.Schema>;
|
|
1909
|
+
parse(field: string, value: string | boolean | number): Button;
|
|
1937
1910
|
remove(): void;
|
|
1938
|
-
static execute(
|
|
1911
|
+
static execute(field: string, value: string | boolean | number): boolean;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
interface Theme {
|
|
1915
|
+
color?: string;
|
|
1916
|
+
background?: string;
|
|
1917
|
+
bold?: boolean;
|
|
1918
|
+
italic?: boolean;
|
|
1919
|
+
fontSize?: number;
|
|
1920
|
+
icon?: string;
|
|
1921
|
+
}
|
|
1922
|
+
interface Options {
|
|
1923
|
+
enabled?: boolean;
|
|
1924
|
+
prefix?: string | (() => string);
|
|
1925
|
+
}
|
|
1926
|
+
type LogMethod = (...args: unknown[]) => void;
|
|
1927
|
+
declare class useLogger {
|
|
1928
|
+
enabled: boolean;
|
|
1929
|
+
prefix: string | (() => string);
|
|
1930
|
+
constructor(options?: Options);
|
|
1931
|
+
apply(theme: Theme): LogMethod;
|
|
1932
|
+
private style;
|
|
1933
|
+
group(label: string): void;
|
|
1934
|
+
groupCollapsed(label: string): void;
|
|
1935
|
+
groupEnd(): void;
|
|
1936
|
+
table(data: unknown): void;
|
|
1937
|
+
time(label: string): void;
|
|
1938
|
+
timeEnd(label: string): void;
|
|
1939
|
+
readonly error: LogMethod;
|
|
1940
|
+
readonly warn: LogMethod;
|
|
1941
|
+
readonly success: LogMethod;
|
|
1942
|
+
readonly info: LogMethod;
|
|
1943
|
+
readonly debug: LogMethod;
|
|
1944
|
+
readonly alert: LogMethod;
|
|
1945
|
+
readonly status: LogMethod;
|
|
1946
|
+
readonly received: LogMethod;
|
|
1947
|
+
readonly simple: LogMethod;
|
|
1939
1948
|
}
|
|
1940
1949
|
|
|
1941
1950
|
type QueueEvents<T> = {
|
|
@@ -2345,6 +2354,13 @@ declare namespace Helper {
|
|
|
2345
2354
|
* @returns The text with emotes replaced by HTML image tags.
|
|
2346
2355
|
*/
|
|
2347
2356
|
function replaceEmotesWithHTML(text: string, emotes: Emote[]): string;
|
|
2357
|
+
/**
|
|
2358
|
+
* Checks if the text contains only emotes and whitespace.
|
|
2359
|
+
* @param text - The text to check.
|
|
2360
|
+
* @param emotes - An array of emotes with their positions in the text.
|
|
2361
|
+
* @returns True if the text contains only emotes and whitespace, false otherwise.
|
|
2362
|
+
*/
|
|
2363
|
+
function hasOnlyEmotes(text: string, emotes: Emote[]): boolean;
|
|
2348
2364
|
/**
|
|
2349
2365
|
* Replaces YouTube emotes in the text with corresponding HTML image tags.
|
|
2350
2366
|
* @param text - The text containing YouTube emotes.
|
|
@@ -2968,9 +2984,11 @@ declare const main: {
|
|
|
2968
2984
|
multistream: {
|
|
2969
2985
|
useComfyJs: typeof useComfyJs;
|
|
2970
2986
|
};
|
|
2971
|
-
|
|
2987
|
+
internal: {
|
|
2972
2988
|
usedStorages: useStorage<any>[];
|
|
2973
2989
|
usedComms: useComms<any>[];
|
|
2990
|
+
usedCommands: Command[];
|
|
2991
|
+
usedButtons: Button[];
|
|
2974
2992
|
};
|
|
2975
2993
|
pronouns: {
|
|
2976
2994
|
Alejo: typeof Alejo;
|
|
@@ -2994,4 +3012,4 @@ declare global {
|
|
|
2994
3012
|
}
|
|
2995
3013
|
|
|
2996
3014
|
export { Alejo, Button, Command, EventProvider, StreamElements, StreamElementsEvents, Twitch, TwitchEvents, YoutubeEvents, main as default, useComfyJs, useLogger, useQueue, useStorage };
|
|
2997
|
-
export type { BttvEmote, ClientEvents$1 as ClientEvents, Emote, Provider$1 as Provider, SeventvEmote, TwitchEmote };
|
|
3015
|
+
export type { BttvEmote, ClientEvents$1 as ClientEvents, Emoji, Emote, Provider$1 as Provider, SeventvEmote, TwitchEmote };
|