koishi-plugin-node-async-bot-all 2.0.0 → 2.0.2
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/index.js +3 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -401,7 +401,6 @@ async function getCASSIE(ctx, session, name2) {
|
|
|
401
401
|
try {
|
|
402
402
|
const fileBuffer = await import_fs2.default.promises.readFile(fullPath);
|
|
403
403
|
log.info(fullPath);
|
|
404
|
-
const bufferToSend = Buffer.from(fileBuffer);
|
|
405
404
|
if (!ctx.silk.isSilk(fileBuffer)) {
|
|
406
405
|
msg = {
|
|
407
406
|
"time": time,
|
|
@@ -411,11 +410,10 @@ async function getCASSIE(ctx, session, name2) {
|
|
|
411
410
|
log.info("Sent: .failed");
|
|
412
411
|
log.info(msg);
|
|
413
412
|
} else {
|
|
414
|
-
const base64Data = bufferToSend.toString("base64");
|
|
415
413
|
log.info("Sent: A audio file.");
|
|
416
414
|
msg = {
|
|
417
415
|
"time": time,
|
|
418
|
-
"data":
|
|
416
|
+
"data": fileBuffer,
|
|
419
417
|
"success": 0
|
|
420
418
|
};
|
|
421
419
|
}
|
|
@@ -443,7 +441,7 @@ async function getCASSIE(ctx, session, name2) {
|
|
|
443
441
|
__name(getCASSIE, "getCASSIE");
|
|
444
442
|
|
|
445
443
|
// package.json
|
|
446
|
-
var version = "2.0.
|
|
444
|
+
var version = "2.0.2";
|
|
447
445
|
|
|
448
446
|
// src/index.ts
|
|
449
447
|
var inject = ["silk", "database"];
|
|
@@ -519,7 +517,7 @@ function apply(ctx) {
|
|
|
519
517
|
ctx.command("cassie [名称:string]").action(async ({ session }, name2) => {
|
|
520
518
|
const cassie = await getCASSIE(ctx, session, name2);
|
|
521
519
|
if (cassie["success"] == 0) {
|
|
522
|
-
return
|
|
520
|
+
return import_koishi.h.audio(cassie["data"], "audio/silk");
|
|
523
521
|
} else if (cassie["success"] == 1) {
|
|
524
522
|
return [`${session.text(".msg", cassie)}`];
|
|
525
523
|
} else if (cassie["success"] == 2) {
|