mirai-js 2.4.3 → 2.6.1
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/.github/FUNDING.yml +1 -1
- package/README.md +5 -0
- package/demo.js +92 -14
- package/dist/browser/mirai-js.js +1 -1
- package/dist/node/BaseType.d.ts +73 -0
- package/dist/node/Bot.d.ts +2 -2
- package/dist/node/Bot.js +1 -1
- package/dist/node/ForwardNode.d.ts +15 -0
- package/dist/node/ForwardNode.js +70 -0
- package/dist/node/Message.d.ts +24 -2
- package/dist/node/Message.js +82 -1
- package/dist/node/core/sendFriendMessage.js +68 -0
- package/package.json +1 -1
- package/src/BaseType.d.ts +73 -0
- package/src/Bot.d.ts +2 -2
- package/src/Bot.js +1 -1
- package/src/Message.d.ts +24 -2
- package/src/Message.js +118 -1
- package/src/core/{sendFirendMessage.js → sendFriendMessage.js} +0 -0
- package/.github/dependabot.yml +0 -14
package/src/Message.js
CHANGED
@@ -98,9 +98,83 @@ class App extends MessageType {
|
|
98
98
|
}
|
99
99
|
}
|
100
100
|
|
101
|
+
class ForwardNodeList extends MessageType {
|
102
|
+
constructor({ nodeList }) {
|
103
|
+
super({ type: 'Forward' });
|
104
|
+
this.nodeList = nodeList;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
const faceMap = new Map([
|
109
|
+
['惊讶', 0], ['撇嘴', 1], ['色', 2], ['发呆', 3], ['得意', 4],
|
110
|
+
['流泪', 5], ['害羞', 6], ['闭嘴', 7], ['睡', 8], ['大哭', 9],
|
111
|
+
['尴尬', 10], ['发怒', 11], ['调皮', 12], ['呲牙', 13], ['微笑', 14],
|
112
|
+
['难过', 15], ['酷', 16], ['抓狂', 18], ['吐', 19], ['偷笑', 20],
|
113
|
+
['可爱', 21], ['白眼', 22], ['傲慢', 23], ['饥饿', 24], ['困', 25],
|
114
|
+
['惊恐', 26], ['流汗', 27], ['憨笑', 28], ['悠闲', 29], ['奋斗', 30],
|
115
|
+
['咒骂', 31], ['疑问', 32], ['嘘', 33], ['晕', 34], ['折磨', 35],
|
116
|
+
['衰', 36], ['骷髅', 37], ['敲打', 38], ['再见', 39], ['发抖', 41],
|
117
|
+
['爱情', 42], ['跳跳', 43], ['猪头', 46], ['拥抱', 49], ['蛋糕', 53],
|
118
|
+
['闪电', 54], ['炸弹', 55], ['刀', 56], ['足球', 57], ['便便', 59],
|
119
|
+
['咖啡', 60], ['饭', 61], ['玫瑰', 63], ['凋谢', 64], ['爱心', 66],
|
120
|
+
['心碎', 67], ['礼物', 69], ['太阳', 74], ['月亮', 75], ['赞', 76],
|
121
|
+
['踩', 77], ['握手', 78], ['胜利', 79], ['飞吻', 85], ['怄火', 86],
|
122
|
+
['西瓜', 89], ['冷汗', 96], ['擦汗', 97], ['抠鼻', 98], ['鼓掌', 99],
|
123
|
+
['糗大了', 100], ['坏笑', 101], ['左哼哼', 102], ['右哼哼', 103], ['哈欠', 104],
|
124
|
+
['鄙视', 105], ['委屈', 106], ['快哭了', 107], ['阴险', 108], ['左亲亲', 109],
|
125
|
+
['吓', 110], ['可怜', 111], ['菜刀', 112], ['啤酒', 113], ['篮球', 114],
|
126
|
+
['乒乓', 115], ['示爱', 116], ['瓢虫', 117], ['抱拳', 118], ['勾引', 119],
|
127
|
+
['拳头', 120], ['差劲', 121], ['爱你', 122], ['不', 123], ['好', 124],
|
128
|
+
['转圈', 125], ['磕头', 126], ['回头', 127], ['跳绳', 128], ['挥手', 129],
|
129
|
+
['激动', 130], ['街舞', 131], ['献吻', 132], ['左太极', 133], ['右太极', 134],
|
130
|
+
['双喜', 136], ['鞭炮', 137], ['灯笼', 138], ['K歌', 140], ['喝彩', 144],
|
131
|
+
['祈祷', 145], ['爆筋', 146], ['棒棒糖', 147], ['喝奶', 148], ['飞机', 151],
|
132
|
+
['钞票', 158], ['药', 168], ['手枪', 169], ['茶', 171], ['眨眼睛', 172],
|
133
|
+
['泪奔', 173], ['无奈', 174], ['卖萌', 175], ['小纠结', 176], ['喷血', 177],
|
134
|
+
['斜眼笑', 178], ['doge', 179], ['惊喜', 180], ['骚扰', 181], ['笑哭', 182],
|
135
|
+
['我最美', 183], ['河蟹', 184], ['羊驼', 185], ['幽灵', 187], ['蛋', 188],
|
136
|
+
['菊花', 190], ['红包', 192], ['大笑', 193], ['不开心', 194], ['冷漠', 197],
|
137
|
+
['呃', 198], ['好棒', 199], ['拜托', 200], ['点赞', 201], ['无聊', 202],
|
138
|
+
['托脸', 203], ['吃', 204], ['送花', 205], ['害怕', 206], ['花痴', 207],
|
139
|
+
['小样儿', 208], ['飙泪', 210], ['我不看', 211], ['托腮', 212], ['啵啵', 214],
|
140
|
+
['糊脸', 215], ['拍头', 216], ['扯一扯', 217], ['舔一舔', 218], ['蹭一蹭', 219],
|
141
|
+
['拽炸天', 220], ['顶呱呱', 221], ['抱抱', 222], ['暴击', 223], ['开枪', 224],
|
142
|
+
['撩一撩', 225], ['拍桌', 226], ['拍手', 227], ['恭喜', 228], ['干杯', 229],
|
143
|
+
['嘲讽', 230], ['哼', 231], ['佛系', 232], ['掐一掐', 233], ['惊呆', 234],
|
144
|
+
['颤抖', 235], ['啃头', 236], ['偷看', 237], ['扇脸', 238], ['原谅', 239],
|
145
|
+
['喷脸', 240], ['生日快乐', 241], ['头撞击', 242], ['甩头', 243], ['扔狗', 244],
|
146
|
+
['加油必胜', 245], ['加油抱抱', 246], ['口罩护体', 247], ['搬砖中', 260], ['忙到飞起', 261],
|
147
|
+
['脑阔疼', 262], ['沧桑', 263], ['捂脸', 264], ['辣眼睛', 265], ['哦哟', 266],
|
148
|
+
['头秃', 267], ['问号脸', 268], ['暗中观察', 269], ['emm', 270], ['吃瓜', 271],
|
149
|
+
['呵呵哒', 272], ['我酸了', 273], ['太南了', 274], ['辣椒酱', 276], ['汪汪', 277],
|
150
|
+
['汗', 278], ['打脸', 279], ['击掌', 280], ['无眼笑', 281], ['敬礼', 282],
|
151
|
+
['狂笑', 283], ['面无表情', 284], ['摸鱼', 285], ['魔鬼笑', 286], ['哦', 287],
|
152
|
+
['请', 288], ['睁眼', 289], ['敲开心', 290], ['震惊', 291], ['让我康康', 292],
|
153
|
+
['摸锦鲤', 293], ['期待', 294], ['拿到红包', 295], ['真好', 296], ['拜谢', 297],
|
154
|
+
['元宝', 298], ['牛啊', 299], ['胖三斤', 300], ['好闪', 301], ['左拜年', 302],
|
155
|
+
['右拜年', 303], ['红包包', 304], ['右亲亲', 305], ['牛气冲天', 306], ['喵喵', 307],
|
156
|
+
['求红包', 308], ['谢红包', 309], ['新年烟花', 310], ['打call', 311], ['变形', 312],
|
157
|
+
['嗑到了', 313], ['仔细分析', 314], ['加油', 315], ['我没事', 316], ['菜狗', 317],
|
158
|
+
['崇拜', 318], ['比心', 319], ['庆祝', 320], ['老色痞', 321], ['拒绝', 322],
|
159
|
+
['嫌弃', 323], ['吃糖', 324]
|
160
|
+
]);
|
161
|
+
|
162
|
+
class Face extends MessageType {
|
163
|
+
constructor({
|
164
|
+
faceId,
|
165
|
+
name
|
166
|
+
}) {
|
167
|
+
super({
|
168
|
+
type: 'Face'
|
169
|
+
});
|
170
|
+
this.faceId = faceId;
|
171
|
+
this.name = name;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
101
175
|
|
102
176
|
/**
|
103
|
-
* @description
|
177
|
+
* @description 本框架抽象的消息类型
|
104
178
|
*/
|
105
179
|
class Message extends MessageChainGetable {
|
106
180
|
constructor() {
|
@@ -188,10 +262,53 @@ class Message extends MessageChainGetable {
|
|
188
262
|
return this;
|
189
263
|
}
|
190
264
|
|
265
|
+
// face
|
266
|
+
addFace(name) {
|
267
|
+
const idx = faceMap.get(name);
|
268
|
+
if (idx) {
|
269
|
+
this.messageChain.push(new Face(
|
270
|
+
{ faceId: idx, name }
|
271
|
+
));
|
272
|
+
}
|
273
|
+
return this;
|
274
|
+
}
|
275
|
+
|
191
276
|
// get 原接口格式的信息链
|
192
277
|
getMessageChain() {
|
193
278
|
return this.messageChain;
|
194
279
|
}
|
280
|
+
|
281
|
+
static createForwardMessage() {
|
282
|
+
return new ForwardMessage();
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
class ForwardMessage extends MessageChainGetable {
|
287
|
+
constructor() {
|
288
|
+
super();
|
289
|
+
this.messageChain = [];
|
290
|
+
this.nodeList = [];
|
291
|
+
}
|
292
|
+
|
293
|
+
addForwardNode(nodeOrId) {
|
294
|
+
if (typeof nodeOrId === 'number') {
|
295
|
+
this.nodeList.push({
|
296
|
+
messageId: nodeOrId
|
297
|
+
});
|
298
|
+
} else if (typeof nodeOrId == 'object') {
|
299
|
+
if (nodeOrId.messageChain instanceof MessageChainGetable) {
|
300
|
+
nodeOrId.messageChain = nodeOrId.messageChain.getMessageChain();
|
301
|
+
}
|
302
|
+
this.nodeList.push(nodeOrId);
|
303
|
+
} /* else ignore */
|
304
|
+
return this;
|
305
|
+
}
|
306
|
+
|
307
|
+
// implements MessageChainGetable
|
308
|
+
getMessageChain() {
|
309
|
+
this.messageChain.push(new ForwardNodeList({ nodeList: this.nodeList }));
|
310
|
+
return this.messageChain;
|
311
|
+
}
|
195
312
|
}
|
196
313
|
|
197
314
|
module.exports = { Message };
|
File without changes
|
package/.github/dependabot.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
3
|
-
# Please see the documentation for all configuration options:
|
4
|
-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
5
|
-
|
6
|
-
version: 2
|
7
|
-
updates:
|
8
|
-
- package-ecosystem: "npm"
|
9
|
-
directory: "/"
|
10
|
-
schedule:
|
11
|
-
interval: "monthly"
|
12
|
-
allow:
|
13
|
-
- dependency-name: "*"
|
14
|
-
|