koishi-plugin-chat-analyse 1.0.4 → 1.0.5
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 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -552,7 +552,7 @@ var Stat = class {
|
|
|
552
552
|
};
|
|
553
553
|
}, "createHandler");
|
|
554
554
|
if (this.config.enableCmdStat) {
|
|
555
|
-
cmd.subcommand("cmdstat", "命令统计").usage("查询命令统计,可指定查询范围,默认当前群组。").option("user", "-u <user:string> 指定用户").option("guild", "-g <guildId:string> 指定群组").option("separate", "-
|
|
555
|
+
cmd.subcommand("cmdstat", "命令统计").usage("查询命令统计,可指定查询范围,默认当前群组。").option("user", "-u <user:string> 指定用户").option("guild", "-g <guildId:string> 指定群组").option("separate", "-s 分离展示").option("all", "-a 全局").action(createHandler(async (scope, options) => {
|
|
556
556
|
const stats = await this.ctx.database.select("analyse_cmd").where({ uid: { $in: scope.uids } }).groupBy("command", { count: /* @__PURE__ */ __name((row) => import_koishi3.$.sum(row.count), "count"), lastUsed: /* @__PURE__ */ __name((row) => import_koishi3.$.max(row.timestamp), "lastUsed") }).orderBy("count", "desc").execute();
|
|
557
557
|
if (stats.length === 0) return "暂无统计数据";
|
|
558
558
|
let processedStats;
|
|
@@ -596,7 +596,7 @@ var Stat = class {
|
|
|
596
596
|
}));
|
|
597
597
|
}
|
|
598
598
|
if (this.config.enableRankStat) {
|
|
599
|
-
cmd.subcommand("rankstat", "发言排行").usage("查询发言排行,可指定查询范围,默认当前群组。").option("guild", "-g <guildId:string> 指定群组").option("type", "-t <type:string> 指定类型").option("hours", "-
|
|
599
|
+
cmd.subcommand("rankstat", "发言排行").usage("查询发言排行,可指定查询范围,默认当前群组。").option("guild", "-g <guildId:string> 指定群组").option("type", "-t <type:string> 指定类型").option("hours", "-t <hours:number> 指定时长", { fallback: 24 }).option("all", "-a 全局").action(createHandler(async (scope, options) => {
|
|
600
600
|
const { hours, type } = options;
|
|
601
601
|
const since = new Date(Date.now() - hours * import_koishi3.Time.hour);
|
|
602
602
|
const query = { uid: { $in: scope.uids }, timestamp: { $gte: since } };
|
|
@@ -613,7 +613,7 @@ var Stat = class {
|
|
|
613
613
|
}));
|
|
614
614
|
}
|
|
615
615
|
if (this.config.enableActivity) {
|
|
616
|
-
cmd.subcommand("activity", "活跃统计").usage("查询活跃统计,可指定查询范围,默认当前群组。").option("user", "-u <user:string> 指定用户").option("guild", "-g <guildId:string> 指定群组").option("hours", "-
|
|
616
|
+
cmd.subcommand("activity", "活跃统计").usage("查询活跃统计,可指定查询范围,默认当前群组。").option("user", "-u <user:string> 指定用户").option("guild", "-g <guildId:string> 指定群组").option("hours", "-t <hours:number> 指定偏移时长").option("all", "-a 全局").option("days", "-d 切换至天数").action(createHandler(async (scope, options) => {
|
|
617
617
|
const { days, hours } = options;
|
|
618
618
|
if (days) {
|
|
619
619
|
const timeRangeInDays = 24;
|