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

Function deleteCommandMessage

tts/tts.ts:20–32  ·  view source on GitHub ↗

私聊删除命令:为双方删除;群/频道:仅自己删除

(msg: Api.Message)

Source from the content-addressed store, hash-verified

18const prefixes = getPrefixes();
19const mainPrefix = prefixes[0];
20
21/** 私聊删除命令:为双方删除;群/频道:仅自己删除 */
22async function deleteCommandMessage(msg: Api.Message) {
23 try {
24 const isPrivate =
25 (msg as any).isPrivate === true ||
26 (msg.peerId instanceof (Api as any).PeerUser);
27
28 if (isPrivate) {
29 await (msg as any).delete({ revoke: true }); // 双向删除
30 } else {
31 await msg.delete(); // 普通删除
32 }
33 } catch { }
34}
35

Callers 1

TTSPluginClass · 0.70

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected