@mkody/twitch-emoticons 2.7.0 → 2.8.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.
Files changed (45) hide show
  1. package/.eslintrc.json +143 -143
  2. package/.github/codeql/codeql-config.yml +4 -4
  3. package/.github/workflows/codeql.yml +50 -50
  4. package/.github/workflows/eslint.yml +50 -50
  5. package/.github/workflows/release.yml +22 -0
  6. package/.github/workflows/yarn-test.yml +17 -17
  7. package/.jsdoc.json +39 -39
  8. package/.nvmrc +1 -0
  9. package/LICENSE +22 -22
  10. package/README.md +36 -4
  11. package/docs/BTTVEmote.html +1641 -1319
  12. package/docs/Channel.html +823 -823
  13. package/docs/Collection.html +797 -797
  14. package/docs/Emote.html +906 -801
  15. package/docs/EmoteFetcher.html +3680 -2946
  16. package/docs/EmoteParser.html +811 -811
  17. package/docs/FFZEmote.html +1795 -1473
  18. package/docs/SevenTV.html +1190 -1190
  19. package/docs/SevenTVEmote.html +1705 -1395
  20. package/docs/TwitchEmote.html +1637 -1315
  21. package/docs/index.html +230 -206
  22. package/docs/struct_BTTVEmote.js.html +162 -132
  23. package/docs/struct_Channel.js.html +127 -127
  24. package/docs/struct_Emote.js.html +151 -138
  25. package/docs/struct_EmoteFetcher.js.html +427 -399
  26. package/docs/struct_EmoteParser.js.html +153 -153
  27. package/docs/struct_FFZEmote.js.html +185 -146
  28. package/docs/struct_SevenTVEmote.js.html +178 -141
  29. package/docs/struct_TwitchEmote.js.html +159 -130
  30. package/docs/util_Collection.js.html +150 -150
  31. package/package.json +57 -57
  32. package/src/index.js +12 -12
  33. package/src/struct/BTTVEmote.js +90 -60
  34. package/src/struct/Channel.js +55 -55
  35. package/src/struct/Emote.js +79 -66
  36. package/src/struct/EmoteFetcher.js +355 -327
  37. package/src/struct/EmoteParser.js +81 -81
  38. package/src/struct/EmoteTypeMapper.js +13 -0
  39. package/src/struct/FFZEmote.js +113 -74
  40. package/src/struct/SevenTVEmote.js +106 -69
  41. package/src/struct/TwitchEmote.js +87 -58
  42. package/src/util/Collection.js +78 -78
  43. package/src/util/Constants.js +31 -31
  44. package/test/index.js +482 -174
  45. package/typings/index.d.ts +115 -98
@@ -1,98 +1,115 @@
1
- declare module '@mkody/twitch-emoticons' {
2
- export class Channel {
3
- public constructor(fetcher: EmoteFetcher, id: number);
4
-
5
- public fetcher: EmoteFetcher;
6
- public id: number;
7
- public emotes: Collection<string, Emote>;
8
-
9
- public fetchBTTVEmotes(): Promise<Collection<string, BTTVEmote>>;
10
- public fetchFFZEmotes(): Promise<Collection<string, FFZEmote>>;
11
- public fetchSevenTVEmotes(): Promise<Collection<string, SevenTVEmote>>;
12
- }
13
-
14
- export abstract class Emote {
15
- public constructor(channel: Channel, id: string, data: object);
16
-
17
- public fetcher: EmoteFetcher;
18
- public channel: Channel;
19
- public id: string;
20
- public type: 'twitch' | 'bttv' | 'ffz' | '7tv';
21
- public code: string;
22
- }
23
-
24
- export class EmoteFetcher {
25
- public constructor(clientId?: string, clientSecret?: string);
26
-
27
- public emotes: Collection<string, Emote>;
28
- public channels: Collection<string, Channel>;
29
-
30
- public fetchTwitchEmotes(id?: number): Promise<Collection<string, TwitchEmote>>;
31
- public fetchBTTVEmotes(id?: number): Promise<Collection<string, BTTVEmote>>;
32
- public fetchFFZEmotes(id: number): Promise<Collection<string, FFZEmote>>;
33
- public fetchSevenTVEmotes(id?: number, format?: 'webp' | 'avif'): Promise<Collection<string, SevenTVEmote>>;
34
- }
35
-
36
- export class EmoteParser {
37
- public constructor(fetcher: EmoteFetcher, options: {
38
- template?: string,
39
- type?: string,
40
- match?: RegExp
41
- });
42
-
43
- public parse(text: string, size?: number): string;
44
- }
45
-
46
- export class TwitchEmote extends Emote {
47
- public constructor(channel: Channel, id: string, data: object);
48
-
49
- public set?: string;
50
- public animated: boolean;
51
- public imageType: 'png' | 'gif';
52
- public readonly owner: Channel;
53
-
54
- public toLink(size: number): string;
55
- }
56
-
57
- export class BTTVEmote extends Emote {
58
- public constructor(channel: Channel, id: string, data: any);
59
-
60
- public ownerName: string;
61
- public animated: boolean;
62
- public imageType: 'webp';
63
- public readonly owner?: Channel;
64
-
65
- public toLink(size: number): string;
66
- }
67
-
68
- export class FFZEmote extends Emote {
69
- public constructor(channel: Channel, id: string, data: object);
70
-
71
- public ownerName: string;
72
- public sizes: string[];
73
- public animated: boolean;
74
- public imageType: 'png' | 'webp';
75
- public modifier: boolean;
76
- public readonly owner?: Channel;
77
-
78
- public toLink(size: number): string;
79
- }
80
-
81
- export class SevenTVEmote extends Emote {
82
- public constructor(channel: Channel, id: string, data: object);
83
-
84
- public ownerName: string;
85
- public sizes: string[];
86
- public animated: boolean;
87
- public imageType: 'webp' | 'avif';
88
- public readonly owner?: Channel;
89
-
90
- public toLink(size: number): string;
91
- }
92
-
93
- export class Collection<K, V> extends Map<K, V> {
94
- public find(propOrFunc: string | ((item: K, index: number, coll: this) => boolean), value?: any): K;
95
- public filter(func: (item: K, index: number, coll: this) => boolean): Collection<K, V>;
96
- public map(func: (item: K, index: number, coll: this) => any): Array<any>;
97
- }
98
- }
1
+ declare module '@mkody/twitch-emoticons' {
2
+ export class Channel {
3
+ public constructor(fetcher: EmoteFetcher, id: number);
4
+
5
+ public fetcher: EmoteFetcher;
6
+ public id: number;
7
+ public emotes: Collection<string, Emote>;
8
+
9
+ public fetchBTTVEmotes(): Promise<Collection<string, BTTVEmote>>;
10
+ public fetchFFZEmotes(): Promise<Collection<string, FFZEmote>>;
11
+ public fetchSevenTVEmotes(): Promise<Collection<string, SevenTVEmote>>;
12
+ }
13
+
14
+ export abstract class Emote {
15
+ public constructor(channel: Channel, id: string, data: object);
16
+
17
+ public fetcher: EmoteFetcher;
18
+ public channel: Channel;
19
+ public id: string;
20
+ public type: 'twitch' | 'bttv' | 'ffz' | '7tv';
21
+ public code: string;
22
+ }
23
+
24
+ export class EmoteFetcher {
25
+ public constructor(clientId?: string, clientSecret?: string);
26
+
27
+ public emotes: Collection<string, Emote>;
28
+ public channels: Collection<string, Channel>;
29
+
30
+ public fetchTwitchEmotes(id?: number): Promise<Collection<string, TwitchEmote>>;
31
+ public fetchBTTVEmotes(id?: number): Promise<Collection<string, BTTVEmote>>;
32
+ public fetchFFZEmotes(id: number): Promise<Collection<string, FFZEmote>>;
33
+ public fetchSevenTVEmotes(id?: number, format?: 'webp' | 'avif'): Promise<Collection<string, SevenTVEmote>>;
34
+ public fromObject(json: EmoteObject[]): Emote[];
35
+ }
36
+
37
+ export class EmoteParser {
38
+ public constructor(fetcher: EmoteFetcher, options: {
39
+ template?: string,
40
+ type?: string,
41
+ match?: RegExp
42
+ });
43
+
44
+ public parse(text: string, size?: number): string;
45
+ }
46
+
47
+ export class TwitchEmote extends Emote {
48
+ public constructor(channel: Channel, id: string, data: object);
49
+
50
+ public set?: string;
51
+ public animated: boolean;
52
+ public imageType: 'png' | 'gif';
53
+ public readonly owner: Channel;
54
+
55
+ public toLink(size: number): string;
56
+ public toObject(): EmoteObject;
57
+ }
58
+
59
+ export class BTTVEmote extends Emote {
60
+ public constructor(channel: Channel, id: string, data: any);
61
+
62
+ public ownerName: string | null;
63
+ public animated: boolean;
64
+ public imageType: 'webp';
65
+ public readonly owner?: Channel;
66
+
67
+ public toLink(size: number): string;
68
+ public toObject(): EmoteObject;
69
+ }
70
+
71
+ export class FFZEmote extends Emote {
72
+ public constructor(channel: Channel, id: string, data: object);
73
+
74
+ public ownerName: string | null;
75
+ public sizes: string[];
76
+ public animated: boolean;
77
+ public imageType: 'png' | 'webp';
78
+ public modifier: boolean;
79
+ public readonly owner?: Channel;
80
+
81
+ public toLink(size: number): string;
82
+ public toObject(): EmoteObject;
83
+ }
84
+
85
+ export class SevenTVEmote extends Emote {
86
+ public constructor(channel: Channel, id: string, data: object);
87
+
88
+ public ownerName: string | null;
89
+ public sizes: string[];
90
+ public animated: boolean;
91
+ public imageType: 'webp' | 'avif';
92
+ public readonly owner?: Channel;
93
+
94
+ public toLink(size: number): string;
95
+ public toObject(): EmoteObject;
96
+ }
97
+
98
+ export interface EmoteObject {
99
+ code: string,
100
+ id: string,
101
+ channel_id: string,
102
+ type: 'twitch' | 'bttv' | 'ffz' | '7tv'
103
+ animated?: boolean,
104
+ ownerName?: string,
105
+ sizes?: string[],
106
+ set?: string,
107
+ imageType?: string
108
+ }
109
+
110
+ export class Collection<K, V> extends Map<K, V> {
111
+ public find(propOrFunc: string | ((item: K, index: number, coll: this) => boolean), value?: any): K;
112
+ public filter(func: (item: K, index: number, coll: this) => boolean): Collection<K, V>;
113
+ public map(func: (item: K, index: number, coll: this) => any): Array<any>;
114
+ }
115
+ }