@tixyel/streamelements 6.4.8 → 6.4.9

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 CHANGED
@@ -1624,85 +1624,6 @@ type BttvEmote = {
1624
1624
  };
1625
1625
  type Emote = TwitchEmote | BttvEmote | SeventvEmote;
1626
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;
1660
- name: string;
1661
- value: string;
1662
- run: ButtonOptions['run'];
1663
- constructor(options: ButtonOptions);
1664
- generate(values: Array<Record<string, string | number>>): Record<string, StreamElements.CustomField.Schema>;
1665
- parse(field: string, value: string | boolean | number): Button;
1666
- remove(): void;
1667
- static execute(field: string, value: string | boolean | number): boolean;
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
- }
1705
-
1706
1627
  /**
1707
1628
  * EventProvider class for managing event listeners and emitters.
1708
1629
  * This class allows you to register event listeners, emit events, and manage event subscriptions.
@@ -1814,6 +1735,44 @@ declare class useStorage<T extends JSONObject> extends EventProvider<UseStorageE
1814
1735
  on<K extends keyof UseStorageEvents<T>>(eventName: K, callback: (this: useStorage<T>, ...args: UseStorageEvents<T>[K]) => void): this;
1815
1736
  }
1816
1737
 
1738
+ interface CommandOptions {
1739
+ prefix?: string;
1740
+ name: string;
1741
+ description?: string;
1742
+ arguments?: boolean;
1743
+ run: (this: Client, args: string[], event: CommandEvent) => void;
1744
+ test?: string;
1745
+ aliases?: string[];
1746
+ permissions?: string[] | boolean;
1747
+ admins?: string[];
1748
+ }
1749
+ type CommandEvent = {
1750
+ provider: 'twitch';
1751
+ data: StreamElements.Event.Provider.Twitch.Message;
1752
+ } | {
1753
+ provider: 'youtube';
1754
+ data: StreamElements.Event.Provider.YouTube.Message;
1755
+ } | {
1756
+ provider: 'kick';
1757
+ data: any;
1758
+ };
1759
+ declare class Command {
1760
+ prefix: string;
1761
+ name: string;
1762
+ description: string;
1763
+ arguments: boolean;
1764
+ test: string | (() => string);
1765
+ aliases: string[];
1766
+ permissions?: string[] | boolean;
1767
+ admins: string[];
1768
+ constructor(options: CommandOptions);
1769
+ run(this: Client | undefined, args: string[], event: CommandEvent): void;
1770
+ verify(nickname: string, roles: string[], args: string[]): boolean;
1771
+ parse(text: string, event: CommandEvent): boolean;
1772
+ remove(): void;
1773
+ static execute(received: CommandEvent): boolean;
1774
+ }
1775
+
1817
1776
  declare namespace Alejo {
1818
1777
  namespace Pronouns {
1819
1778
  type name = 'hehim' | 'sheher' | 'theythem' | 'shethem' | 'hethem' | 'heshe' | 'xexem' | 'faefaer' | 'vever' | 'aeaer' | 'ziehir' | 'perper' | 'eem' | 'itits';
@@ -1900,42 +1859,83 @@ declare class Client extends EventProvider<ClientEvents> {
1900
1859
  on<K extends keyof ClientEvents>(eventName: K, callback: (this: Client, ...args: ClientEvents[K]) => void): this;
1901
1860
  }
1902
1861
 
1903
- interface CommandOptions {
1904
- prefix?: string;
1905
- name: string;
1906
- description?: string;
1907
- arguments?: boolean;
1908
- run: (this: Client, args: string[], event: CommandEvent) => void;
1909
- test?: string;
1910
- aliases?: string[];
1911
- permissions?: string[] | boolean;
1912
- admins?: string[];
1862
+ interface ButtonOptions {
1863
+ field: string | ((field: string, value: string | boolean | number) => boolean);
1864
+ template?: string;
1865
+ name?: string;
1866
+ value?: string;
1867
+ run: (this: Client | undefined, field: string, value: string | boolean | number) => void;
1913
1868
  }
1914
- type CommandEvent = {
1915
- provider: 'twitch';
1916
- data: StreamElements.Event.Provider.Twitch.Message;
1917
- } | {
1918
- provider: 'youtube';
1919
- data: StreamElements.Event.Provider.YouTube.Message;
1920
- } | {
1921
- provider: 'kick';
1922
- data: any;
1923
- };
1924
- declare class Command {
1925
- prefix: string;
1869
+ /**
1870
+ * Represents a button action that can be triggered by custom fields in StreamElements.
1871
+ * The button can be configured with a template and a name, and it will execute a specified function when triggered.
1872
+ * @example
1873
+ * ```javascript
1874
+ * const button = new Button({
1875
+ * field: (field, value) => field.startsWith('message-') && field.split('-')[1],
1876
+ * template: 'message-{role}',
1877
+ * // name: '[CAP={role}] role message',
1878
+ * name: 'Generate {role} message',
1879
+ * run(field, value) {
1880
+ * console.log(`Button ${field} was clicked with value: ${value}`);
1881
+ * }
1882
+ * })
1883
+ *
1884
+ * const field = button.generate([{ role: 'broadcaster' }, { role: 'moderator' }]);
1885
+ * // This will create buttons with fields "message-broadcaster" and "message-moderator" and names "Generate broadcaster message" and "Generate moderator message".
1886
+ * // field['message-broadcaster'] => { type: 'button', label: 'Generate broadcaster message' }
1887
+ * // field['message-moderator'] => { type: 'button', label: 'Generate moderator message' }
1888
+ *
1889
+ * // 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.
1890
+ * ```
1891
+ */
1892
+ declare class Button {
1893
+ field: ButtonOptions['field'];
1894
+ template: string;
1926
1895
  name: string;
1927
- description: string;
1928
- arguments: boolean;
1929
- test: string | (() => string);
1930
- aliases: string[];
1931
- permissions?: string[] | boolean;
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;
1896
+ value: string;
1897
+ run: ButtonOptions['run'];
1898
+ constructor(options: ButtonOptions);
1899
+ generate(values: Array<Record<string, string | number>>): Record<string, StreamElements.CustomField.Schema>;
1900
+ parse(field: string, value: string | boolean | number): Button;
1937
1901
  remove(): void;
1938
- static execute(received: CommandEvent): boolean;
1902
+ static execute(field: string, value: string | boolean | number): boolean;
1903
+ }
1904
+
1905
+ interface Theme {
1906
+ color?: string;
1907
+ background?: string;
1908
+ bold?: boolean;
1909
+ italic?: boolean;
1910
+ fontSize?: number;
1911
+ icon?: string;
1912
+ }
1913
+ interface Options {
1914
+ enabled?: boolean;
1915
+ prefix?: string | (() => string);
1916
+ }
1917
+ type LogMethod = (...args: unknown[]) => void;
1918
+ declare class useLogger {
1919
+ enabled: boolean;
1920
+ prefix: string | (() => string);
1921
+ constructor(options?: Options);
1922
+ apply(theme: Theme): LogMethod;
1923
+ private style;
1924
+ group(label: string): void;
1925
+ groupCollapsed(label: string): void;
1926
+ groupEnd(): void;
1927
+ table(data: unknown): void;
1928
+ time(label: string): void;
1929
+ timeEnd(label: string): void;
1930
+ readonly error: LogMethod;
1931
+ readonly warn: LogMethod;
1932
+ readonly success: LogMethod;
1933
+ readonly info: LogMethod;
1934
+ readonly debug: LogMethod;
1935
+ readonly alert: LogMethod;
1936
+ readonly status: LogMethod;
1937
+ readonly received: LogMethod;
1938
+ readonly simple: LogMethod;
1939
1939
  }
1940
1940
 
1941
1941
  type QueueEvents<T> = {
@@ -2968,9 +2968,11 @@ declare const main: {
2968
2968
  multistream: {
2969
2969
  useComfyJs: typeof useComfyJs;
2970
2970
  };
2971
- data: {
2971
+ internal: {
2972
2972
  usedStorages: useStorage<any>[];
2973
2973
  usedComms: useComms<any>[];
2974
+ usedCommands: Command[];
2975
+ usedButtons: Button[];
2974
2976
  };
2975
2977
  pronouns: {
2976
2978
  Alejo: typeof Alejo;