alemonjs 2.1.0-alpha.40 → 2.1.0-alpha.42
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/adapter.js +114 -0
- package/lib/app/define-chidren.d.ts +1 -2
- package/lib/app/define-chidren.js +1 -1
- package/lib/app/event-group.d.ts +1 -2
- package/lib/app/event-middleware.d.ts +1 -2
- package/lib/app/event-middleware.js +1 -1
- package/lib/app/event-processor-cycle.d.ts +1 -2
- package/lib/app/event-processor-cycle.js +12 -6
- package/lib/app/event-processor-event.d.ts +2 -3
- package/lib/app/event-processor-middleware.d.ts +2 -3
- package/lib/app/event-processor-subscribe.d.ts +2 -3
- package/lib/app/event-processor.d.ts +1 -2
- package/lib/app/event-response.d.ts +1 -2
- package/lib/app/hook-use-api.d.ts +3 -4
- package/lib/app/hook-use-api.js +1 -1
- package/lib/app/hook-use-state.js +1 -1
- package/lib/app/hook-use-subscribe.d.ts +3 -4
- package/lib/app/hook-use-subscribe.js +1 -1
- package/lib/app/load.js +5 -6
- package/lib/app/message-api.d.ts +2 -2
- package/lib/app/message-api.js +1 -1
- package/lib/app/message-format.d.ts +7 -8
- package/lib/app/store.d.ts +6 -6
- package/lib/cbp/actions.js +1 -1
- package/lib/cbp/api.js +1 -1
- package/lib/cbp/client.js +1 -1
- package/lib/cbp/connect.js +1 -1
- package/lib/cbp/platform.d.ts +1 -2
- package/lib/cbp/platform.js +3 -3
- package/lib/cbp/server.js +1 -1
- package/lib/cbp/testone.js +1 -1
- package/lib/cbp/typings.d.ts +2 -3
- package/lib/core/config.d.ts +1 -2
- package/lib/core/config.js +1 -2
- package/lib/core/utils.d.ts +1 -1
- package/lib/core/utils.js +2 -3
- package/lib/core/variable.d.ts +16 -0
- package/lib/core/variable.js +19 -6
- package/lib/global.d.ts +5 -5
- package/lib/index.d.ts +29 -29
- package/lib/index.js +3 -3
- package/lib/main.js +14 -28
- package/lib/types/actions.d.ts +93 -0
- package/lib/types/apis.d.ts +18 -0
- package/lib/types/client/index.d.ts +66 -0
- package/lib/types/cycle/index.d.ts +42 -0
- package/lib/types/event/actions.d.ts +37 -0
- package/lib/types/event/actions.js +72 -0
- package/lib/types/event/base/expansion.d.ts +5 -0
- package/lib/types/event/base/guild.d.ts +18 -0
- package/lib/types/event/base/message.d.ts +28 -0
- package/lib/types/event/base/platform.d.ts +16 -0
- package/lib/types/event/base/user.d.ts +34 -0
- package/lib/types/event/channal/index.d.ts +13 -0
- package/lib/types/event/guild/index.d.ts +13 -0
- package/lib/types/event/index.d.ts +94 -0
- package/lib/types/event/interaction/index.d.ts +14 -0
- package/lib/types/event/map.d.ts +36 -0
- package/lib/types/event/member/index.d.ts +14 -0
- package/lib/types/event/message/message.d.ts +23 -0
- package/lib/types/event/message/private.message.d.ts +16 -0
- package/lib/types/event/request/index.d.ts +13 -0
- package/lib/types/logger/index.d.ts +49 -0
- package/lib/types/message/ark.d.ts +46 -0
- package/lib/types/message/button.d.ts +32 -0
- package/lib/types/message/image.d.ts +23 -0
- package/lib/types/message/index.d.ts +16 -0
- package/lib/types/message/link.d.ts +12 -0
- package/lib/types/message/markdown.d.ts +91 -0
- package/lib/types/message/mention.d.ts +16 -0
- package/lib/types/message/text.d.ts +12 -0
- package/lib/types/package/index.d.ts +12 -0
- package/lib/types/state/index.d.ts +5 -0
- package/lib/types/store/res.d.ts +75 -0
- package/lib/types/subscribe/index.d.ts +30 -0
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +3 -8
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -131,17 +131,15 @@ async function createPicFrom(options) {
|
|
|
131
131
|
const base64Data = image.split(',')[1];
|
|
132
132
|
const buffer = Buffer.from(base64Data, 'base64');
|
|
133
133
|
const type = await fileTypeFromBuffer(buffer);
|
|
134
|
-
name = 'file.' + (type?.ext
|
|
134
|
+
name = 'file.' + (type?.ext ?? 'jpg');
|
|
135
135
|
pushBuffer(buffer);
|
|
136
136
|
}
|
|
137
|
-
// file path
|
|
138
137
|
else if (existsSync(image)) {
|
|
139
138
|
if (!name) {
|
|
140
139
|
name = basename(image);
|
|
141
140
|
}
|
|
142
141
|
picData = createReadStream(image);
|
|
143
142
|
}
|
|
144
|
-
// invalid string
|
|
145
143
|
else {
|
|
146
144
|
return;
|
|
147
145
|
}
|
|
@@ -149,7 +147,7 @@ async function createPicFrom(options) {
|
|
|
149
147
|
else if (Buffer.isBuffer(image)) {
|
|
150
148
|
if (!name) {
|
|
151
149
|
const type = await fileTypeFromBuffer(image);
|
|
152
|
-
name = 'file.' + (type?.ext
|
|
150
|
+
name = 'file.' + (type?.ext ?? 'jpg');
|
|
153
151
|
}
|
|
154
152
|
pushBuffer(image);
|
|
155
153
|
}
|
|
@@ -157,7 +155,7 @@ async function createPicFrom(options) {
|
|
|
157
155
|
if (!name) {
|
|
158
156
|
const img = Readable.toWeb(image);
|
|
159
157
|
const type = await fileTypeFromStream(img);
|
|
160
|
-
name = 'file.' + (type?.ext
|
|
158
|
+
name = 'file.' + (type?.ext ?? 'jpg');
|
|
161
159
|
}
|
|
162
160
|
picData = image;
|
|
163
161
|
}
|
|
@@ -188,9 +186,6 @@ const getPublicIP = async (options = {}) => {
|
|
|
188
186
|
* 正则表达式工具类
|
|
189
187
|
*/
|
|
190
188
|
class Regular extends RegExp {
|
|
191
|
-
constructor(pattern, flags) {
|
|
192
|
-
super(pattern, flags);
|
|
193
|
-
}
|
|
194
189
|
static or(...regs) {
|
|
195
190
|
return new Regular(`(${regs.map(reg => reg.source).join('|')})`, regs.map(reg => reg.flags).join(''));
|
|
196
191
|
}
|