Update handlers.ts
This commit is contained in:
1 parent
b4ece4e772
commit
983b882b90
1 file changed
+5
-5
@@ -3,7 +3,7 @@ import { getLinks, addLink, updateLink, deleteLink, getFeeds, addFeed, updateFee
|
||||
import { moveToRecycle } from "@/lib/recycle";
|
||||
import { deployQueue } from "@/lib/git";
|
||||
import { hugo } from "@/lib/hugo";
|
||||
import { getLanIP, DEFAULT_AUTHOR } from "@/lib/config";
|
||||
import { getLanIP, DEFAULT_AUTHOR, BLOG_ROOT } from "@/lib/config";
|
||||
import { sendMessage, tg } from "./tg";
|
||||
import { getSession, hasSession, clearSession, saveSession, undoLastChunk, initSessionDir } from "./sessions";
|
||||
import { makeSlug, sessionSummary, truncateText } from "./helpers";
|
||||
@@ -671,13 +671,13 @@ handlers.read = async (chatId) => {
|
||||
|
||||
handlers.stats = async (chatId) => {
|
||||
try {
|
||||
const res = await fetch(BLOG_ROOT + "/index.xml");
|
||||
const data = await getStats();
|
||||
const posts = await listPosts({ page: 1, perPage: 10000 });
|
||||
const lines = ["📊 <b>网站数据</b>\n"];
|
||||
lines.push("📝 文章总数:" + data.totalPosts + " 篇");
|
||||
lines.push("💬 评论总数:" + data.totalComments + " 条");
|
||||
lines.push("📝 文章总数:" + posts.total + " 篇");
|
||||
lines.push("🌐 访问地址:https://post.usj.cc");
|
||||
await sendMain(chatId, lines.join("\n"));
|
||||
} catch (e) { await sendMain(chatId, "⚠️ 获取失败,请稍后再试"); }
|
||||
};
|
||||
|
||||
export default handlers;
|
||||
| ||||