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