fishpi 0.0.21 → 0.0.22

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/lib/emoji.d.ts ADDED
@@ -0,0 +1,201 @@
1
+ declare class Emoji {
2
+ private _apiKey;
3
+ private _emojis;
4
+ constructor(token?: string);
5
+ /**
6
+ * 重新设置请求 Token
7
+ * @param apiKey 接口 API Key
8
+ */
9
+ setToken(token: string): void;
10
+ get default(): {
11
+ doge: string;
12
+ trollface: string;
13
+ huaji: string;
14
+ octocat: string;
15
+ wulian: string;
16
+ smile: string;
17
+ laughing: string;
18
+ blush: string;
19
+ smiley: string;
20
+ relaxed: string;
21
+ smirk: string;
22
+ heart_eyes: string;
23
+ kissing_heart: string;
24
+ kissing_closed_eyes: string;
25
+ flushed: string;
26
+ relieved: string;
27
+ satisfied: string;
28
+ grin: string;
29
+ wink: string;
30
+ stuck_out_tongue_winking_eye: string;
31
+ stuck_out_tongue_closed_eyes: string;
32
+ grinning: string;
33
+ kissing: string;
34
+ kissing_smiling_eyes: string;
35
+ stuck_out_tongue: string;
36
+ sleeping: string;
37
+ worried: string;
38
+ frowning: string;
39
+ anguished: string;
40
+ open_mouth: string;
41
+ grimacing: string;
42
+ confused: string;
43
+ hushed: string;
44
+ expressionless: string;
45
+ unamused: string;
46
+ sweat_smile: string;
47
+ sweat: string;
48
+ disappointed_relieved: string;
49
+ weary: string;
50
+ pensive: string;
51
+ disappointed: string;
52
+ confounded: string;
53
+ fearful: string;
54
+ cold_sweat: string;
55
+ persevere: string;
56
+ cry: string;
57
+ sob: string;
58
+ joy: string;
59
+ astonished: string;
60
+ scream: string;
61
+ tired_face: string;
62
+ angry: string;
63
+ rage: string;
64
+ triumph: string;
65
+ sleepy: string;
66
+ yum: string;
67
+ mask: string;
68
+ sunglasses: string;
69
+ dizzy_face: string;
70
+ imp: string;
71
+ smiling_imp: string;
72
+ neutral_face: string;
73
+ no_mouth: string;
74
+ innocent: string;
75
+ alien: string;
76
+ yellow_heart: string;
77
+ blue_heart: string;
78
+ purple_heart: string;
79
+ heart: string;
80
+ green_heart: string;
81
+ broken_heart: string;
82
+ heartbeat: string;
83
+ heartpulse: string;
84
+ two_hearts: string;
85
+ revolving_hearts: string;
86
+ cupid: string;
87
+ sparkling_heart: string;
88
+ sparkles: string;
89
+ star: string;
90
+ star2: string;
91
+ dizzy: string;
92
+ boom: string;
93
+ collision: string;
94
+ anger: string;
95
+ exclamation: string;
96
+ question: string;
97
+ grey_exclamation: string;
98
+ grey_question: string;
99
+ zzz: string;
100
+ dash: string;
101
+ sweat_drops: string;
102
+ notes: string;
103
+ musical_note: string;
104
+ fire: string;
105
+ poop: string;
106
+ "+1": string;
107
+ thumbsup: string;
108
+ "-1": string;
109
+ thumbsdown: string;
110
+ ok_hand: string;
111
+ punch: string;
112
+ facepunch: string;
113
+ fist: string;
114
+ v: string;
115
+ wave: string;
116
+ hand: string;
117
+ raised_hand: string;
118
+ open_hands: string;
119
+ point_up: string;
120
+ point_down: string;
121
+ point_left: string;
122
+ point_right: string;
123
+ raised_hands: string;
124
+ pray: string;
125
+ point_up_2: string;
126
+ clap: string;
127
+ muscle: string;
128
+ couple: string;
129
+ family: string;
130
+ two_men_holding_hands: string;
131
+ two_women_holding_hands: string;
132
+ dancer: string;
133
+ dancers: string;
134
+ ok_woman: string;
135
+ no_good: string;
136
+ information_desk_person: string;
137
+ raising_hand: string;
138
+ bride_with_veil: string;
139
+ person_with_pouting_face: string;
140
+ person_frowning: string;
141
+ bow: string;
142
+ couplekiss: string;
143
+ couple_with_heart: string;
144
+ massage: string;
145
+ haircut: string;
146
+ nail_care: string;
147
+ boy: string;
148
+ girl: string;
149
+ woman: string;
150
+ man: string;
151
+ baby: string;
152
+ older_woman: string;
153
+ older_man: string;
154
+ person_with_blond_hair: string;
155
+ man_with_gua_pi_mao: string;
156
+ man_with_turban: string;
157
+ construction_worker: string;
158
+ cop: string;
159
+ angel: string;
160
+ princess: string;
161
+ smiley_cat: string;
162
+ smile_cat: string;
163
+ heart_eyes_cat: string;
164
+ kissing_cat: string;
165
+ smirk_cat: string;
166
+ scream_cat: string;
167
+ crying_cat_face: string;
168
+ joy_cat: string;
169
+ pouting_cat: string;
170
+ japanese_ogre: string;
171
+ japanese_goblin: string;
172
+ see_no_evil: string;
173
+ hear_no_evil: string;
174
+ speak_no_evil: string;
175
+ guardsman: string;
176
+ skull: string;
177
+ feet: string;
178
+ lips: string;
179
+ kiss: string;
180
+ droplet: string;
181
+ ear: string;
182
+ eyes: string;
183
+ nose: string;
184
+ tongue: string;
185
+ love_letter: string;
186
+ bust_in_silhouette: string;
187
+ busts_in_silhouette: string;
188
+ speech_balloon: string;
189
+ thought_balloon: string;
190
+ };
191
+ get(): Promise<Array<string>>;
192
+ /**
193
+ * 设置表情包列表
194
+ * @param data 所有表情包图像列表
195
+ */
196
+ set(data: Array<string>): Promise<any>;
197
+ append(url: string): Promise<Array<string>>;
198
+ remove(url: string): Promise<Array<string>>;
199
+ exists(url: string): Promise<Boolean>;
200
+ }
201
+ export default Emoji;
package/lib/emoji.js ADDED
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var utils_1 = require("./utils");
40
+ var Emoji = /** @class */ (function () {
41
+ function Emoji(token) {
42
+ if (token === void 0) { token = ''; }
43
+ this._apiKey = '';
44
+ this._emojis = [];
45
+ if (!token) {
46
+ return;
47
+ }
48
+ this.setToken(token);
49
+ }
50
+ /**
51
+ * 重新设置请求 Token
52
+ * @param apiKey 接口 API Key
53
+ */
54
+ Emoji.prototype.setToken = function (token) {
55
+ var _this = this;
56
+ this._apiKey = token;
57
+ if (token)
58
+ this.get().then(function (e) { return _this._emojis = e; }).catch(function () { });
59
+ };
60
+ Object.defineProperty(Emoji.prototype, "default", {
61
+ get: function () {
62
+ return {
63
+ "doge": "https://cdn.jsdelivr.net/npm/vditor@3.8.7/dist/images/emoji/doge.png",
64
+ "trollface": "https://cdn.jsdelivr.net/npm/vditor@3.8.7/dist/images/emoji/trollface.png",
65
+ "huaji": "https://cdn.jsdelivr.net/npm/vditor@3.8.7/dist/images/emoji/huaji.gif",
66
+ "octocat": "https://cdn.jsdelivr.net/npm/vditor@3.8.7/dist/images/emoji/octocat.png",
67
+ "wulian": "https://cdn.jsdelivr.net/npm/vditor@3.8.7/dist/images/emoji/wulian.png",
68
+ "smile": "https://file.".concat(utils_1.domain, "/emoji/graphics/smile.png"),
69
+ "laughing": "https://file.".concat(utils_1.domain, "/emoji/graphics/laughing.png"),
70
+ "blush": "https://file.".concat(utils_1.domain, "/emoji/graphics/blush.png"),
71
+ "smiley": "https://file.".concat(utils_1.domain, "/emoji/graphics/smiley.png"),
72
+ "relaxed": "https://file.".concat(utils_1.domain, "/emoji/graphics/relaxed.png"),
73
+ "smirk": "https://file.".concat(utils_1.domain, "/emoji/graphics/smirk.png"),
74
+ "heart_eyes": "https://file.".concat(utils_1.domain, "/emoji/graphics/heart_eyes.png"),
75
+ "kissing_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/kissing_heart.png"),
76
+ "kissing_closed_eyes": "https://file.".concat(utils_1.domain, "/emoji/graphics/kissing_closed_eyes.png"),
77
+ "flushed": "https://file.".concat(utils_1.domain, "/emoji/graphics/flushed.png"),
78
+ "relieved": "https://file.".concat(utils_1.domain, "/emoji/graphics/relieved.png"),
79
+ "satisfied": "https://file.".concat(utils_1.domain, "/emoji/graphics/satisfied.png"),
80
+ "grin": "https://file.".concat(utils_1.domain, "/emoji/graphics/grin.png"),
81
+ "wink": "https://file.".concat(utils_1.domain, "/emoji/graphics/wink.png"),
82
+ "stuck_out_tongue_winking_eye": "https://file.".concat(utils_1.domain, "/emoji/graphics/stuck_out_tongue_winking_eye.png"),
83
+ "stuck_out_tongue_closed_eyes": "https://file.".concat(utils_1.domain, "/emoji/graphics/stuck_out_tongue_closed_eyes.png"),
84
+ "grinning": "https://file.".concat(utils_1.domain, "/emoji/graphics/grinning.png"),
85
+ "kissing": "https://file.".concat(utils_1.domain, "/emoji/graphics/kissing.png"),
86
+ "kissing_smiling_eyes": "https://file.".concat(utils_1.domain, "/emoji/graphics/kissing_smiling_eyes.png"),
87
+ "stuck_out_tongue": "https://file.".concat(utils_1.domain, "/emoji/graphics/stuck_out_tongue.png"),
88
+ "sleeping": "https://file.".concat(utils_1.domain, "/emoji/graphics/sleeping.png"),
89
+ "worried": "https://file.".concat(utils_1.domain, "/emoji/graphics/worried.png"),
90
+ "frowning": "https://file.".concat(utils_1.domain, "/emoji/graphics/frowning.png"),
91
+ "anguished": "https://file.".concat(utils_1.domain, "/emoji/graphics/anguished.png"),
92
+ "open_mouth": "https://file.".concat(utils_1.domain, "/emoji/graphics/open_mouth.png"),
93
+ "grimacing": "https://file.".concat(utils_1.domain, "/emoji/graphics/grimacing.png"),
94
+ "confused": "https://file.".concat(utils_1.domain, "/emoji/graphics/confused.png"),
95
+ "hushed": "https://file.".concat(utils_1.domain, "/emoji/graphics/hushed.png"),
96
+ "expressionless": "https://file.".concat(utils_1.domain, "/emoji/graphics/expressionless.png"),
97
+ "unamused": "https://file.".concat(utils_1.domain, "/emoji/graphics/unamused.png"),
98
+ "sweat_smile": "https://file.".concat(utils_1.domain, "/emoji/graphics/sweat_smile.png"),
99
+ "sweat": "https://file.".concat(utils_1.domain, "/emoji/graphics/sweat.png"),
100
+ "disappointed_relieved": "https://file.".concat(utils_1.domain, "/emoji/graphics/disappointed_relieved.png"),
101
+ "weary": "https://file.".concat(utils_1.domain, "/emoji/graphics/weary.png"),
102
+ "pensive": "https://file.".concat(utils_1.domain, "/emoji/graphics/pensive.png"),
103
+ "disappointed": "https://file.".concat(utils_1.domain, "/emoji/graphics/disappointed.png"),
104
+ "confounded": "https://file.".concat(utils_1.domain, "/emoji/graphics/confounded.png"),
105
+ "fearful": "https://file.".concat(utils_1.domain, "/emoji/graphics/fearful.png"),
106
+ "cold_sweat": "https://file.".concat(utils_1.domain, "/emoji/graphics/cold_sweat.png"),
107
+ "persevere": "https://file.".concat(utils_1.domain, "/emoji/graphics/persevere.png"),
108
+ "cry": "https://file.".concat(utils_1.domain, "/emoji/graphics/cry.png"),
109
+ "sob": "https://file.".concat(utils_1.domain, "/emoji/graphics/sob.png"),
110
+ "joy": "https://file.".concat(utils_1.domain, "/emoji/graphics/joy.png"),
111
+ "astonished": "https://file.".concat(utils_1.domain, "/emoji/graphics/astonished.png"),
112
+ "scream": "https://file.".concat(utils_1.domain, "/emoji/graphics/scream.png"),
113
+ "tired_face": "https://file.".concat(utils_1.domain, "/emoji/graphics/tired_face.png"),
114
+ "angry": "https://file.".concat(utils_1.domain, "/emoji/graphics/angry.png"),
115
+ "rage": "https://file.".concat(utils_1.domain, "/emoji/graphics/rage.png"),
116
+ "triumph": "https://file.".concat(utils_1.domain, "/emoji/graphics/triumph.png"),
117
+ "sleepy": "https://file.".concat(utils_1.domain, "/emoji/graphics/sleepy.png"),
118
+ "yum": "https://file.".concat(utils_1.domain, "/emoji/graphics/yum.png"),
119
+ "mask": "https://file.".concat(utils_1.domain, "/emoji/graphics/mask.png"),
120
+ "sunglasses": "https://file.".concat(utils_1.domain, "/emoji/graphics/sunglasses.png"),
121
+ "dizzy_face": "https://file.".concat(utils_1.domain, "/emoji/graphics/dizzy_face.png"),
122
+ "imp": "https://file.".concat(utils_1.domain, "/emoji/graphics/imp.png"),
123
+ "smiling_imp": "https://file.".concat(utils_1.domain, "/emoji/graphics/smiling_imp.png"),
124
+ "neutral_face": "https://file.".concat(utils_1.domain, "/emoji/graphics/neutral_face.png"),
125
+ "no_mouth": "https://file.".concat(utils_1.domain, "/emoji/graphics/no_mouth.png"),
126
+ "innocent": "https://file.".concat(utils_1.domain, "/emoji/graphics/innocent.png"),
127
+ "alien": "https://file.".concat(utils_1.domain, "/emoji/graphics/alien.png"),
128
+ "yellow_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/yellow_heart.png"),
129
+ "blue_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/blue_heart.png"),
130
+ "purple_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/purple_heart.png"),
131
+ "heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/heart.png"),
132
+ "green_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/green_heart.png"),
133
+ "broken_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/broken_heart.png"),
134
+ "heartbeat": "https://file.".concat(utils_1.domain, "/emoji/graphics/heartbeat.png"),
135
+ "heartpulse": "https://file.".concat(utils_1.domain, "/emoji/graphics/heartpulse.png"),
136
+ "two_hearts": "https://file.".concat(utils_1.domain, "/emoji/graphics/two_hearts.png"),
137
+ "revolving_hearts": "https://file.".concat(utils_1.domain, "/emoji/graphics/revolving_hearts.png"),
138
+ "cupid": "https://file.".concat(utils_1.domain, "/emoji/graphics/cupid.png"),
139
+ "sparkling_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/sparkling_heart.png"),
140
+ "sparkles": "https://file.".concat(utils_1.domain, "/emoji/graphics/sparkles.png"),
141
+ "star": "https://file.".concat(utils_1.domain, "/emoji/graphics/star.png"),
142
+ "star2": "https://file.".concat(utils_1.domain, "/emoji/graphics/star2.png"),
143
+ "dizzy": "https://file.".concat(utils_1.domain, "/emoji/graphics/dizzy.png"),
144
+ "boom": "https://file.".concat(utils_1.domain, "/emoji/graphics/boom.png"),
145
+ "collision": "https://file.".concat(utils_1.domain, "/emoji/graphics/collision.png"),
146
+ "anger": "https://file.".concat(utils_1.domain, "/emoji/graphics/anger.png"),
147
+ "exclamation": "https://file.".concat(utils_1.domain, "/emoji/graphics/exclamation.png"),
148
+ "question": "https://file.".concat(utils_1.domain, "/emoji/graphics/question.png"),
149
+ "grey_exclamation": "https://file.".concat(utils_1.domain, "/emoji/graphics/grey_exclamation.png"),
150
+ "grey_question": "https://file.".concat(utils_1.domain, "/emoji/graphics/grey_question.png"),
151
+ "zzz": "https://file.".concat(utils_1.domain, "/emoji/graphics/zzz.png"),
152
+ "dash": "https://file.".concat(utils_1.domain, "/emoji/graphics/dash.png"),
153
+ "sweat_drops": "https://file.".concat(utils_1.domain, "/emoji/graphics/sweat_drops.png"),
154
+ "notes": "https://file.".concat(utils_1.domain, "/emoji/graphics/notes.png"),
155
+ "musical_note": "https://file.".concat(utils_1.domain, "/emoji/graphics/musical_note.png"),
156
+ "fire": "https://file.".concat(utils_1.domain, "/emoji/graphics/fire.png"),
157
+ "poop": "https://file.".concat(utils_1.domain, "/emoji/graphics/poop.png"),
158
+ "+1": "https://file.".concat(utils_1.domain, "/emoji/graphics/%2B1.png"),
159
+ "thumbsup": "https://file.".concat(utils_1.domain, "/emoji/graphics/thumbsup.png"),
160
+ "-1": "https://file.".concat(utils_1.domain, "/emoji/graphics/-1.png"),
161
+ "thumbsdown": "https://file.".concat(utils_1.domain, "/emoji/graphics/thumbsdown.png"),
162
+ "ok_hand": "https://file.".concat(utils_1.domain, "/emoji/graphics/ok_hand.png"),
163
+ "punch": "https://file.".concat(utils_1.domain, "/emoji/graphics/punch.png"),
164
+ "facepunch": "https://file.".concat(utils_1.domain, "/emoji/graphics/facepunch.png"),
165
+ "fist": "https://file.".concat(utils_1.domain, "/emoji/graphics/fist.png"),
166
+ "v": "https://file.".concat(utils_1.domain, "/emoji/graphics/v.png"),
167
+ "wave": "https://file.".concat(utils_1.domain, "/emoji/graphics/wave.png"),
168
+ "hand": "https://file.".concat(utils_1.domain, "/emoji/graphics/hand.png"),
169
+ "raised_hand": "https://file.".concat(utils_1.domain, "/emoji/graphics/raised_hand.png"),
170
+ "open_hands": "https://file.".concat(utils_1.domain, "/emoji/graphics/open_hands.png"),
171
+ "point_up": "https://file.".concat(utils_1.domain, "/emoji/graphics/point_up.png"),
172
+ "point_down": "https://file.".concat(utils_1.domain, "/emoji/graphics/point_down.png"),
173
+ "point_left": "https://file.".concat(utils_1.domain, "/emoji/graphics/point_left.png"),
174
+ "point_right": "https://file.".concat(utils_1.domain, "/emoji/graphics/point_right.png"),
175
+ "raised_hands": "https://file.".concat(utils_1.domain, "/emoji/graphics/raised_hands.png"),
176
+ "pray": "https://file.".concat(utils_1.domain, "/emoji/graphics/pray.png"),
177
+ "point_up_2": "https://file.".concat(utils_1.domain, "/emoji/graphics/point_up_2.png"),
178
+ "clap": "https://file.".concat(utils_1.domain, "/emoji/graphics/clap.png"),
179
+ "muscle": "https://file.".concat(utils_1.domain, "/emoji/graphics/muscle.png"),
180
+ "couple": "https://file.".concat(utils_1.domain, "/emoji/graphics/couple.png"),
181
+ "family": "https://file.".concat(utils_1.domain, "/emoji/graphics/family.png"),
182
+ "two_men_holding_hands": "https://file.".concat(utils_1.domain, "/emoji/graphics/two_men_holding_hands.png"),
183
+ "two_women_holding_hands": "https://file.".concat(utils_1.domain, "/emoji/graphics/two_women_holding_hands.png"),
184
+ "dancer": "https://file.".concat(utils_1.domain, "/emoji/graphics/dancer.png"),
185
+ "dancers": "https://file.".concat(utils_1.domain, "/emoji/graphics/dancers.png"),
186
+ "ok_woman": "https://file.".concat(utils_1.domain, "/emoji/graphics/ok_woman.png"),
187
+ "no_good": "https://file.".concat(utils_1.domain, "/emoji/graphics/no_good.png"),
188
+ "information_desk_person": "https://file.".concat(utils_1.domain, "/emoji/graphics/information_desk_person.png"),
189
+ "raising_hand": "https://file.".concat(utils_1.domain, "/emoji/graphics/raising_hand.png"),
190
+ "bride_with_veil": "https://file.".concat(utils_1.domain, "/emoji/graphics/bride_with_veil.png"),
191
+ "person_with_pouting_face": "https://file.".concat(utils_1.domain, "/emoji/graphics/person_with_pouting_face.png"),
192
+ "person_frowning": "https://file.".concat(utils_1.domain, "/emoji/graphics/person_frowning.png"),
193
+ "bow": "https://file.".concat(utils_1.domain, "/emoji/graphics/bow.png"),
194
+ "couplekiss": "https://file.".concat(utils_1.domain, "/emoji/graphics/couplekiss.png"),
195
+ "couple_with_heart": "https://file.".concat(utils_1.domain, "/emoji/graphics/couple_with_heart.png"),
196
+ "massage": "https://file.".concat(utils_1.domain, "/emoji/graphics/massage.png"),
197
+ "haircut": "https://file.".concat(utils_1.domain, "/emoji/graphics/haircut.png"),
198
+ "nail_care": "https://file.".concat(utils_1.domain, "/emoji/graphics/nail_care.png"),
199
+ "boy": "https://file.".concat(utils_1.domain, "/emoji/graphics/boy.png"),
200
+ "girl": "https://file.".concat(utils_1.domain, "/emoji/graphics/girl.png"),
201
+ "woman": "https://file.".concat(utils_1.domain, "/emoji/graphics/woman.png"),
202
+ "man": "https://file.".concat(utils_1.domain, "/emoji/graphics/man.png"),
203
+ "baby": "https://file.".concat(utils_1.domain, "/emoji/graphics/baby.png"),
204
+ "older_woman": "https://file.".concat(utils_1.domain, "/emoji/graphics/older_woman.png"),
205
+ "older_man": "https://file.".concat(utils_1.domain, "/emoji/graphics/older_man.png"),
206
+ "person_with_blond_hair": "https://file.".concat(utils_1.domain, "/emoji/graphics/person_with_blond_hair.png"),
207
+ "man_with_gua_pi_mao": "https://file.".concat(utils_1.domain, "/emoji/graphics/man_with_gua_pi_mao.png"),
208
+ "man_with_turban": "https://file.".concat(utils_1.domain, "/emoji/graphics/man_with_turban.png"),
209
+ "construction_worker": "https://file.".concat(utils_1.domain, "/emoji/graphics/construction_worker.png"),
210
+ "cop": "https://file.".concat(utils_1.domain, "/emoji/graphics/cop.png"),
211
+ "angel": "https://file.".concat(utils_1.domain, "/emoji/graphics/angel.png"),
212
+ "princess": "https://file.".concat(utils_1.domain, "/emoji/graphics/princess.png"),
213
+ "smiley_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/smiley_cat.png"),
214
+ "smile_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/smile_cat.png"),
215
+ "heart_eyes_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/heart_eyes_cat.png"),
216
+ "kissing_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/kissing_cat.png"),
217
+ "smirk_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/smirk_cat.png"),
218
+ "scream_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/scream_cat.png"),
219
+ "crying_cat_face": "https://file.".concat(utils_1.domain, "/emoji/graphics/crying_cat_face.png"),
220
+ "joy_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/joy_cat.png"),
221
+ "pouting_cat": "https://file.".concat(utils_1.domain, "/emoji/graphics/pouting_cat.png"),
222
+ "japanese_ogre": "https://file.".concat(utils_1.domain, "/emoji/graphics/japanese_ogre.png"),
223
+ "japanese_goblin": "https://file.".concat(utils_1.domain, "/emoji/graphics/japanese_goblin.png"),
224
+ "see_no_evil": "https://file.".concat(utils_1.domain, "/emoji/graphics/see_no_evil.png"),
225
+ "hear_no_evil": "https://file.".concat(utils_1.domain, "/emoji/graphics/hear_no_evil.png"),
226
+ "speak_no_evil": "https://file.".concat(utils_1.domain, "/emoji/graphics/speak_no_evil.png"),
227
+ "guardsman": "https://file.".concat(utils_1.domain, "/emoji/graphics/guardsman.png"),
228
+ "skull": "https://file.".concat(utils_1.domain, "/emoji/graphics/skull.png"),
229
+ "feet": "https://file.".concat(utils_1.domain, "/emoji/graphics/feet.png"),
230
+ "lips": "https://file.".concat(utils_1.domain, "/emoji/graphics/lips.png"),
231
+ "kiss": "https://file.".concat(utils_1.domain, "/emoji/graphics/kiss.png"),
232
+ "droplet": "https://file.".concat(utils_1.domain, "/emoji/graphics/droplet.png"),
233
+ "ear": "https://file.".concat(utils_1.domain, "/emoji/graphics/ear.png"),
234
+ "eyes": "https://file.".concat(utils_1.domain, "/emoji/graphics/eyes.png"),
235
+ "nose": "https://file.".concat(utils_1.domain, "/emoji/graphics/nose.png"),
236
+ "tongue": "https://file.".concat(utils_1.domain, "/emoji/graphics/tongue.png"),
237
+ "love_letter": "https://file.".concat(utils_1.domain, "/emoji/graphics/love_letter.png"),
238
+ "bust_in_silhouette": "https://file.".concat(utils_1.domain, "/emoji/graphics/bust_in_silhouette.png"),
239
+ "busts_in_silhouette": "https://file.".concat(utils_1.domain, "/emoji/graphics/busts_in_silhouette.png"),
240
+ "speech_balloon": "https://file.".concat(utils_1.domain, "/emoji/graphics/speech_balloon.png"),
241
+ "thought_balloon": "https://file.".concat(utils_1.domain, "/emoji/graphics/thought_balloon.png")
242
+ };
243
+ },
244
+ enumerable: false,
245
+ configurable: true
246
+ });
247
+ Emoji.prototype.get = function () {
248
+ return __awaiter(this, void 0, void 0, function () {
249
+ var rsp, e_1;
250
+ return __generator(this, function (_a) {
251
+ switch (_a.label) {
252
+ case 0:
253
+ _a.trys.push([0, 2, , 3]);
254
+ return [4 /*yield*/, (0, utils_1.request)({
255
+ url: "api/cloud/get",
256
+ method: 'post',
257
+ data: {
258
+ gameId: 'emojis',
259
+ apiKey: this._apiKey
260
+ },
261
+ })];
262
+ case 1:
263
+ rsp = _a.sent();
264
+ this._emojis = JSON.parse(rsp.data);
265
+ return [2 /*return*/, this._emojis.concat([])];
266
+ case 2:
267
+ e_1 = _a.sent();
268
+ throw e_1;
269
+ case 3: return [2 /*return*/];
270
+ }
271
+ });
272
+ });
273
+ };
274
+ /**
275
+ * 设置表情包列表
276
+ * @param data 所有表情包图像列表
277
+ */
278
+ Emoji.prototype.set = function (data) {
279
+ return __awaiter(this, void 0, void 0, function () {
280
+ var rsp, e_2;
281
+ return __generator(this, function (_a) {
282
+ switch (_a.label) {
283
+ case 0:
284
+ _a.trys.push([0, 2, , 3]);
285
+ return [4 /*yield*/, (0, utils_1.request)({
286
+ url: "api/cloud/sync",
287
+ method: 'post',
288
+ data: {
289
+ gameId: 'emojis',
290
+ data: JSON.stringify(data),
291
+ apiKey: this._apiKey
292
+ },
293
+ })];
294
+ case 1:
295
+ rsp = _a.sent();
296
+ return [2 /*return*/, rsp];
297
+ case 2:
298
+ e_2 = _a.sent();
299
+ throw e_2;
300
+ case 3: return [2 /*return*/];
301
+ }
302
+ });
303
+ });
304
+ };
305
+ Emoji.prototype.append = function (url) {
306
+ return __awaiter(this, void 0, void 0, function () {
307
+ var emojis, _a;
308
+ return __generator(this, function (_b) {
309
+ switch (_b.label) {
310
+ case 0:
311
+ if (!(this._emojis.length > 0)) return [3 /*break*/, 1];
312
+ _a = this._emojis;
313
+ return [3 /*break*/, 3];
314
+ case 1: return [4 /*yield*/, this.get()];
315
+ case 2:
316
+ _a = _b.sent();
317
+ _b.label = 3;
318
+ case 3:
319
+ emojis = _a;
320
+ if (emojis.indexOf(url) >= 0)
321
+ throw (new Error('表情包已存在'));
322
+ emojis.push(url);
323
+ return [4 /*yield*/, this.set(emojis)];
324
+ case 4:
325
+ _b.sent();
326
+ this._emojis = emojis;
327
+ return [2 /*return*/, emojis.concat([])];
328
+ }
329
+ });
330
+ });
331
+ };
332
+ Emoji.prototype.remove = function (url) {
333
+ return __awaiter(this, void 0, void 0, function () {
334
+ var emojis, _a;
335
+ return __generator(this, function (_b) {
336
+ switch (_b.label) {
337
+ case 0:
338
+ if (!(this._emojis.length > 0)) return [3 /*break*/, 1];
339
+ _a = this._emojis;
340
+ return [3 /*break*/, 3];
341
+ case 1: return [4 /*yield*/, this.get()];
342
+ case 2:
343
+ _a = _b.sent();
344
+ _b.label = 3;
345
+ case 3:
346
+ emojis = _a;
347
+ if (emojis.indexOf(url) < 0)
348
+ return [2 /*return*/, emojis];
349
+ emojis.splice(emojis.indexOf(url), 1);
350
+ return [4 /*yield*/, this.set(emojis)];
351
+ case 4:
352
+ _b.sent();
353
+ this._emojis = emojis;
354
+ return [2 /*return*/, emojis.concat([])];
355
+ }
356
+ });
357
+ });
358
+ };
359
+ Emoji.prototype.exists = function (url) {
360
+ return __awaiter(this, void 0, void 0, function () {
361
+ var emojis, _a;
362
+ return __generator(this, function (_b) {
363
+ switch (_b.label) {
364
+ case 0:
365
+ if (!(this._emojis.length > 0)) return [3 /*break*/, 1];
366
+ _a = this._emojis;
367
+ return [3 /*break*/, 3];
368
+ case 1: return [4 /*yield*/, this.get()];
369
+ case 2:
370
+ _a = _b.sent();
371
+ _b.label = 3;
372
+ case 3:
373
+ emojis = _a;
374
+ return [2 /*return*/, emojis.indexOf(url) >= 0];
375
+ }
376
+ });
377
+ });
378
+ };
379
+ return Emoji;
380
+ }());
381
+ exports.default = Emoji;
package/lib/index.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ import { ApiResponse, Account, UserInfo, AtUserList, UploadInfo, ApiKey } from './typing';
2
+ import ChatRoom from './chatroom';
3
+ import Notice from './notice';
4
+ import Emoji from './emoji';
5
+ import User from './user';
6
+ import Article from './article';
7
+ import Chat from './chat';
8
+ import Breezemoon from './breezemoon';
9
+ declare class FishPi {
10
+ /**
11
+ * 请求 API 的 API Key
12
+ */
13
+ apiKey: string;
14
+ /**
15
+ * 聊天室接口对象
16
+ */
17
+ chatroom: ChatRoom;
18
+ /**
19
+ * 通知接口对象
20
+ */
21
+ notice: Notice;
22
+ /**
23
+ * 表情包接口对象
24
+ */
25
+ emoji: Emoji;
26
+ /**
27
+ * 用户接口对象
28
+ */
29
+ account: User;
30
+ /**
31
+ * 文章接口对象
32
+ */
33
+ article: Article;
34
+ /**
35
+ * 清风明月对象
36
+ */
37
+ breezemoon: Breezemoon;
38
+ /**
39
+ * 私聊接口对象
40
+ */
41
+ chat: Chat;
42
+ /**
43
+ * 构造一个 API 请求对象
44
+ * @param token 接口 API Key,没有可以传空
45
+ */
46
+ constructor(token?: string);
47
+ setToken(apiKey: string): Promise<void>;
48
+ setDomain(domain: string): Promise<void>;
49
+ /**
50
+ * 登录账号返回 API Key
51
+ * @param data 用户账密
52
+ */
53
+ login(data: Account): Promise<ApiKey>;
54
+ /**
55
+ * 查询指定用户信息
56
+ * @param username 用户名
57
+ */
58
+ user(username: string): Promise<ApiResponse<UserInfo>>;
59
+ /**
60
+ * 用户名联想,通常用于 @ 列表
61
+ * @param username 用户名
62
+ */
63
+ names(name: string): Promise<AtUserList>;
64
+ /**
65
+ * 上传文件
66
+ * @param files 要上传的文件,如果是在 Node 使用,则传入文件路径数组,若是在浏览器使用,则传入文件对象数组。
67
+ */
68
+ upload(files: Array<File | string>): Promise<ApiResponse<UploadInfo>>;
69
+ }
70
+ export default FishPi;
71
+ export * from './typing';