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

Function ensureBotReady

netease/netease.ts:52–82  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

50 await client.invoke(new Api.contacts.Unblock({ id: bot }));
51 } catch {}
52
53 try {
54 const inputPeer = await client.getInputEntity(bot);
55 await client.invoke(
56 new Api.account.UpdateNotifySettings({
57 peer: new Api.InputNotifyPeer({ peer: inputPeer }),
58 settings: new Api.InputPeerNotifySettings({
59 silent: true,
60 muteUntil: 2147483647,
61 }),
62 })
63 );
64 } catch {}
65
66 // 启动 bot(首次使用)
67 try {
68 await msg.client?.invoke(
69 new Api.messages.StartBot({ bot, peer: bot, startParam: "" })
70 );
71 } catch {
72 try {
73 await msg.client?.sendMessage(bot, { message: "/start" });
74 } catch {}
75 }
76}
77
78async function fetchAndSendAudio(
79 msg: Api.Message,
80 commandToBot: string,
81 caption: string
82) {
83 const client = msg.client!;
84 const startTs = Math.floor(Date.now() / 1000);
85

Callers 1

NeteasePluginClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected