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

Class MoyuPlugin

moyu/moyu.ts:14–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14class MoyuPlugin extends Plugin {
15
16 description: string = "摸鱼日报";
17 cmdHandlers: Record<string, (msg: Api.Message) => Promise<void>> = {
18 moyu: async (msg) => {
19 try {
20 await msg.edit({ text: "开摸..." });
21 const caption = `摸鱼日报 ${formatCN(new Date())}`;
22
23 const res = await axios.get(url, {
24 responseType: "arraybuffer",
25 validateStatus: () => true,
26 });
27
28 const buf = Buffer.from(res.data);
29 const file = new CustomFile(`moyu.jpg`, buf.length, "", buf);
30
31 await msg.client?.sendFile(msg.peerId, {
32 file,
33 caption,
34 forceDocument: false,
35 });
36 await msg.delete();
37 } catch (error) {
38 console.error("[MoyuPlugin] 执行失败:", error);
39 try {
40 await msg.edit({ text: "❌ 获取摸鱼日报失败,请稍后重试" });
41 } catch (_) {

Callers

nothing calls this directly

Calls 4

formatCNFunction · 0.85
editMethod · 0.45
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected