koishi-plugin-node-async-bot-all 2.28.0 → 2.29.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.
- package/lib/index.js +35 -19
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -939,7 +939,7 @@ async function getUse(ctx, session, qq, desc) {
|
|
|
939
939
|
__name(getUse, "getUse");
|
|
940
940
|
|
|
941
941
|
// package.json
|
|
942
|
-
var version = "2.
|
|
942
|
+
var version = "2.29.0";
|
|
943
943
|
|
|
944
944
|
// src/index.ts
|
|
945
945
|
var inject = ["database", "installer", "puppeteer", "cron"];
|
|
@@ -1006,6 +1006,11 @@ async function endReaction(session) {
|
|
|
1006
1006
|
await session.bot.createReaction(session.channelId, session.messageId, `face|144`);
|
|
1007
1007
|
}
|
|
1008
1008
|
__name(endReaction, "endReaction");
|
|
1009
|
+
async function endReactionFailed(session) {
|
|
1010
|
+
await session.bot.deleteReaction(session.channelId, session.messageId, `face|424`);
|
|
1011
|
+
await session.bot.createReaction(session.channelId, session.messageId, `face|41`);
|
|
1012
|
+
}
|
|
1013
|
+
__name(endReactionFailed, "endReactionFailed");
|
|
1009
1014
|
function apply(ctx) {
|
|
1010
1015
|
ctx.i18n.define("zh-CN", require_zh_CN());
|
|
1011
1016
|
ctx.on("ready", async () => {
|
|
@@ -1058,49 +1063,54 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
|
|
|
1058
1063
|
na.subcommand("cxGame").action(async ({ session }) => {
|
|
1059
1064
|
await startReaction(session);
|
|
1060
1065
|
const cx = await getServer(ctx, session);
|
|
1061
|
-
await endReaction(session);
|
|
1062
1066
|
if (cx["success"] == 0) {
|
|
1063
|
-
|
|
1067
|
+
await session?.send(session?.text(".msg", cx));
|
|
1068
|
+
await endReaction(session);
|
|
1064
1069
|
} else if (cx["success"] == 1) {
|
|
1065
|
-
|
|
1070
|
+
await session?.send(session?.text(".forbidden", cx));
|
|
1071
|
+
await endReactionFailed(session);
|
|
1066
1072
|
} else if (cx["success"] == 2) {
|
|
1067
|
-
|
|
1073
|
+
await session?.send(session?.text(".failed", cx));
|
|
1074
|
+
await endReactionFailed(session);
|
|
1068
1075
|
}
|
|
1069
1076
|
});
|
|
1070
1077
|
na.subcommand("status").alias("stats").alias("状态").action(async ({ session }) => {
|
|
1071
1078
|
await startReaction(session);
|
|
1072
1079
|
const status2 = await getStatus(ctx, session);
|
|
1073
|
-
await endReaction(session);
|
|
1074
1080
|
if (status2["success"] == 0) {
|
|
1075
|
-
|
|
1081
|
+
await session?.send(session?.text(".msg", status2));
|
|
1082
|
+
await endReaction(session);
|
|
1076
1083
|
} else {
|
|
1077
|
-
|
|
1084
|
+
await session?.send(session?.text(".failed", status2));
|
|
1085
|
+
await endReactionFailed(session);
|
|
1078
1086
|
}
|
|
1079
1087
|
});
|
|
1080
1088
|
na.subcommand("random [最小数:number] [最大数:number]").alias("随机数").action(async ({ session }, min, max) => {
|
|
1081
1089
|
await startReaction(session);
|
|
1082
1090
|
const random2 = await getRandom(ctx, session, min, max);
|
|
1091
|
+
await session?.send(session?.text(".msg", random2));
|
|
1083
1092
|
await endReaction(session);
|
|
1084
|
-
return session?.text(".msg", random2);
|
|
1085
1093
|
});
|
|
1086
1094
|
na.subcommand("info").action(async ({ session }) => {
|
|
1087
1095
|
await startReaction(session);
|
|
1088
1096
|
const info = await getInfo(ctx, session);
|
|
1089
|
-
await endReaction(session);
|
|
1090
1097
|
if (info["success"] == 0) {
|
|
1091
|
-
|
|
1098
|
+
await session?.send(session?.text(".msg", info));
|
|
1099
|
+
await endReaction(session);
|
|
1092
1100
|
} else {
|
|
1093
|
-
|
|
1101
|
+
await session?.send(session?.text(".failed", info));
|
|
1102
|
+
await endReactionFailed(session);
|
|
1094
1103
|
}
|
|
1095
1104
|
});
|
|
1096
1105
|
na.subcommand("rw").action(async ({ session }) => {
|
|
1097
1106
|
await startReaction(session);
|
|
1098
1107
|
const rw = await getRandomWord(ctx, session);
|
|
1099
|
-
await endReaction(session);
|
|
1100
1108
|
if (rw["success"] == 0) {
|
|
1101
|
-
|
|
1109
|
+
await session?.send(session?.text(".msg", rw));
|
|
1110
|
+
await endReaction(session);
|
|
1102
1111
|
} else {
|
|
1103
|
-
|
|
1112
|
+
await session?.send(session?.text(".failed", rw));
|
|
1113
|
+
await endReactionFailed(session);
|
|
1104
1114
|
}
|
|
1105
1115
|
});
|
|
1106
1116
|
na.subcommand("randomBA").alias("随机ba图").action(async ({ session }) => {
|
|
@@ -1111,8 +1121,8 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
|
|
|
1111
1121
|
na.subcommand("centerServerTest").alias("测测中心服务器").action(async ({ session }) => {
|
|
1112
1122
|
await startReaction(session);
|
|
1113
1123
|
const msg = await centerServerTest(ctx, session);
|
|
1124
|
+
await session?.send(session?.text(msg.success, msg.data));
|
|
1114
1125
|
await endReaction(session);
|
|
1115
|
-
return session?.text(msg.success, msg.data);
|
|
1116
1126
|
});
|
|
1117
1127
|
na.subcommand("meme [序号:posint]").alias("memes").action(async ({ session }, count) => {
|
|
1118
1128
|
await startReaction(session);
|
|
@@ -1125,8 +1135,11 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
|
|
|
1125
1135
|
await endReaction(session);
|
|
1126
1136
|
});
|
|
1127
1137
|
na.subcommand("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
|
|
1128
|
-
if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
|
|
1129
1138
|
await startReaction(session);
|
|
1139
|
+
if (qq == void 0 || isNaN(Number(qq))) {
|
|
1140
|
+
await endReactionFailed(session);
|
|
1141
|
+
return session?.text(".command");
|
|
1142
|
+
}
|
|
1130
1143
|
await getQQInfo(ctx, session, qq);
|
|
1131
1144
|
await endReaction(session);
|
|
1132
1145
|
});
|
|
@@ -1136,9 +1149,12 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
|
|
|
1136
1149
|
await endReaction(session);
|
|
1137
1150
|
});
|
|
1138
1151
|
na.subcommand("use <user:user> [方法:string]").alias("u").action(async ({ session }, user, desc) => {
|
|
1139
|
-
const qq = user?.split(":")?.[1];
|
|
1140
|
-
if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
|
|
1141
1152
|
await startReaction(session);
|
|
1153
|
+
const qq = user?.split(":")?.[1];
|
|
1154
|
+
if (qq == void 0 || isNaN(Number(qq))) {
|
|
1155
|
+
await endReactionFailed(session);
|
|
1156
|
+
return session?.text(".command");
|
|
1157
|
+
}
|
|
1142
1158
|
await getUse(ctx, session, qq, desc);
|
|
1143
1159
|
await endReaction(session);
|
|
1144
1160
|
});
|