MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / createTelegraphPage

Method createTelegraphPage

deepwiki/deepwiki.ts:742–763  ·  view source on GitHub ↗
(markdown: string, titleSource?: string)

Source from the content-addressed store, hash-verified

740 }
741
742 private async createTelegraphPage(markdown: string, titleSource?: string): Promise<{ url: string; title: string }> {
743 const tgToken = await this.ensureTelegraphToken();
744 const rawTitle = (titleSource || "").replace(/\s+/g, " ").trim();
745 const shortTitle = rawTitle.length > 24 ? `${rawTitle.slice(0, 24)}…` : rawTitle;
746 const title = shortTitle || `DeepWiki - ${new Date().toLocaleString()}`;
747 const nodes = TelegraphFormatter.toNodes(markdown);
748
749 const response = await this.httpClient.request({
750 url: "https://api.telegra.ph/createPage",
751 method: "POST",
752 data: {
753 access_token: tgToken,
754 title,
755 content: nodes,
756 return_content: false,
757 },
758 });
759
760 const url = response.data?.result?.url;
761 if (!url) throw new Error(response.data?.error || "Telegraph页面创建失败");
762 return { url, title };
763 }
764
765 private async sendAnswerOrTelegraph(
766 msg: Api.Message,

Callers 1

sendAnswerOrTelegraphMethod · 0.95

Calls 2

ensureTelegraphTokenMethod · 0.95
requestMethod · 0.45

Tested by

no test coverage detected