Add room-scoped Matrix plugins and bilingual configuration commands

This commit is contained in:
Matrix Bot Project committed 2026-11-20 23:29:33 +08:00
1 parent 061bfbd12a
commit f4f30c3b5c
75 files changed
+2559 -1975

No files matched your search

+40 -54
View File
@@ -1,59 +1,45 @@
# 账号:每个唯一账号只会登录一次并复用一个 client。
# 多个 bot 引用同一 account ⇒ 共享账号;引用不同 account ⇒ 独立身份。
#
# homeServer 填账号域名即可(如 https://matrix.org),程序会自动通过
# /.well-known/matrix/client 发现真实 API 地址。
# 也可直接填真实 API 地址跳过发现。
#
# 密码用 env(VAR_NAME) 引用环境变量,避免明文密码入版本库。
# 在 .env 文件中设置对应的环境变量(参见 .env.example)。
accounts:
main:
homeServer: "https://matrix.example.com"
userId: "@mybot:example.com"
password: "env(MAIN_PW)"
checkin:
homeServer: "https://matrix.example.com"
userId: "@checkin:example.com"
password: "env(CHECKIN_PW)"
homeServer: "https://matrix.example.org"
userId: "@bot:example.org"
password: "env(BOT_PASSWORD)"
# 每个 bot 是一个独立功能模块,声明用哪个账号、管哪些房间、私有配置。
bots:
- name: checkin
account: checkin
rooms:
- "!yourRoomId:example.com" # 替换为真实 Matrix 房间 ID(以 ! 开头)
config:
mainRoom: "!yourRoomId:example.com" # 日报/月报发送的目标房间(默认取 rooms[0])
kickDays: 30 # 未签到超过多少天触发自动踢人
autoKick: false # true 时每日日报后自动踢出长期未签到用户
adminPowerLevel: 100 # 房间内 power level ≥ 此值视为管理员(100=管理员、50=版主)
admins: [] # 额外管理员白名单(power level 之外的补充,可留空)
# - "@admin:example.com"
whitelist: [] # 额外的免踢白名单(注意:权限分 >= adminPowerLevel 的人已自动免死,无需填在此处。这里只填低权限但免踢的特权用户,比如机器人或老板账号)
# - "@vip:example.com"
# Only server-installed, trusted modules are loaded from these directories.
pluginDirectories:
- "./plugins"
# 示例:共享 main 账号的另一个 bot(实现后取消注释并启用)
# - name: notify
# account: main
# rooms:
# - "!anotherRoom:example.com"
rooms:
- account: main
roomId: "!control:example.org"
locale: zh-CN
timeZone: Asia/Shanghai
adminPowerLevel: 100
admins: []
plugins:
checkin:
enabled: true
config:
reportsEnabled: true
cleanupEnabled: false
autoCleanup: false
kickDays: 30
whitelist: []
room-manager:
enabled: false
config:
workRoom1: "!work1:example.org"
workRoom2: "!work2:example.org"
lostRoom: "!lost:example.org"
mode: business
syncPowerChanges: false
syncOnJoin: false
syncOnLeave: false
autoReconcile: false
levelA: 50
levelB: 0
levelC: -1
# =======================================================
# 原生权限联动保安 (room-manager)
# =======================================================
# 该机器人不靠命令驱动,而是监听 Matrix 原生权限(Power Level)。
# 管理员在客户端(Element)直接改成员权限,机器人会自动拉/踢人。
- name: room-manager
account: main
rooms:
- "!checkinRoomId:example.com" # 【务必】只填签到/管理房的ID!作为控制中枢。
config:
workRoom1: "!workRoom1Id:example.com" # 工作房 A (核心群)
workRoom2: "!workRoom2Id:example.com" # 工作房 B (普通群)
lostRoom: "!lostRoomId:example.com" # 失联房 (小黑屋)
# 分数映射 (对应 Element 客户端里的权限设定)
levelA: 50 # 最高权限(如版主50):进工作房1 + 进工作房2
levelB: 0 # 中等权限(如默认0) :踢出工作房1 + 保留在工作房2
levelC: -1 # 最低权限(如受限-1):踢出工作房1、2 + 丢进失联房
# For an existing v1 database, explicitly assign the shared check-in data.
# legacyCheckinTarget:
# account: main
# roomId: "!control:example.org"