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

Function dc

dc/dc.ts:15–260  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

13 if (args.length > 1) {
14 await msg.edit({
15 text: "❌ 参数错误,最多只能指定一个用户",
16 parseMode: "html",
17 });
18 return;
19 }
20
21 const client = await getGlobalClient();
22 if (!client) {
23 await msg.edit({
24 text: "❌ Telegram客户端未初始化",
25 parseMode: "html",
26 });
27 return;
28 }
29
30 await msg.edit({
31 text: "🔍 <b>正在获取 DC 信息...</b>",
32 parseMode: "html",
33 });
34
35 try {
36 // 如果是回复消息
37 if (msg.replyTo) {
38 const replyMessage = await safeGetReplyMessage(msg);
39 if (!replyMessage) {
40 await msg.edit({
41 text: "❌ 无法获取回复的消息",
42 parseMode: "html",
43 });
44 return;
45 }
46
47 const senderId = replyMessage.senderId;
48 if (!senderId) {
49 await msg.edit({
50 text: "❌ 无法获取回复消息的发送者",
51 parseMode: "html",
52 });
53 return;
54 }
55
56 try {
57 // 尝试获取用户信息
58 const fullUser = await client.invoke(
59 new Api.users.GetFullUser({
60 id: await client.getInputEntity(senderId),
61 })
62 );
63
64 const user = fullUser.users[0] as Api.User;
65 if (!user.photo || user.photo.className === "UserProfilePhotoEmpty") {
66 await msg.edit({
67 text: "❌ 目标用户没有头像,无法获取 DC 信息",
68 parseMode: "html",
69 });
70 return;
71 }
72

Callers

nothing calls this directly

Calls 3

errorMethod · 0.80
htmlEscapeFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected