Markdown

1. 标题

一级标题

二级标题

三级标题

四级标题

五级标题
六级标题

2. 文字样式

斜体斜体
粗体粗体
粗斜体粗斜体
删除线
行内代码

3. 列表

无序列表

  • 项目1
  • 项目2
  • 项目3

有序列表

  1. 第一项
  2. 第二项

任务列表

  • 已完成
  • 未完成

4. 链接与图片

链接文字

图片描述

5. 引用

单行引用

多行引用

6. 代码块

本人不懂代码全靠ai

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import plugin from '../../lib/plugins/plugin.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const RECORD_FILE = path.join(__dirname, '../../data/you/lastTrigger.json');

export class DetectYouPlugin extends plugin {
constructor() {
super({
name: "detect-you",
dsc: "有的兄弟",
event: "message",
priority: 10,
rule: [{
reg: "^.*有.*$",
fnc: "detectYou"
}]
});
this._initFile();
}

// 初始化存储文件
async _initFile() {
if (!fs.existsSync(RECORD_FILE)) {
fs.writeFileSync(RECORD_FILE, '{"lastDate":null}');
}
}

// 中国时区日期判断
_isSameDay(d1, d2) {
const opts = { timeZone: 'Asia/Shanghai' };
return d1.toLocaleDateString('zh-CN', opts) === d2.toLocaleDateString('zh-CN', opts);
}

async detectYou(e) {
const now = new Date();
let lastDate = null;

// 读取记录文件
try {
const data = fs.readFileSync(RECORD_FILE, 'utf8');
lastDate = JSON.parse(data).lastDate;
} catch (err) {
console.error('[有字检测] 读取记录失败:', err);
}

// 检查是否同一天
if (lastDate && this._isSameDay(new Date(lastDate), now)) {
return false;
}

// 更新记录并回复
fs.writeFileSync(RECORD_FILE, JSON.stringify({ lastDate: now.toISOString() }));
await e.reply([
"检测到有字,自动回复有的兄弟,有的\n极致的韧性——杨戬\n极致的真伤——吕布\n极致的控制——达摩\n极致的减速——夏洛特\n极致的支援——关羽\n极致的手法——元歌\n极致的爆发——李信\n极致的免伤——蒙恬\n极致的台词——司空震\n这么强的英雄当然不止一个了,这些都是当前版本t0.5级别的强势英雄,掌握一到两个牢九门英雄的话,上个荣耀百星小国标那都是没有问题的。如果你能掌握一半以上的牢九门英雄的话,那你打个巅峰前百前十那也相当轻松。要像主播一样九位英雄全部熟练度拉满那你可以直接去登上KPL职业比赛对抗路的赛场,直接去打职业首发了兄弟"
].join('\n'));

return true;
}
}

多行代码

左对齐 居中对齐 右对齐
单元格 单元格 单元格



红色文字