docs(comments): 注释中文化 · internal/services/channelbridge(纯替换)
- 只翻注释/文档字符串:剥掉注释后代码行逐字节不变(机械校验只剩允许的行尾注释形态) - 术语对齐既有译法(owner→主人、persona→角色、engage→参与度判定、quiet hours→安静时段、backoff→退避) - 复核:go build 绿 + channelbridge 包测试绿;gofmt 干净
This commit is contained in:
1 parent
61cf80d5ee
commit
093f38d986
28 files changed
+1089
-1089
No files matched your search
@@ -4,16 +4,16 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/channel/adapter"
|
||||
)
|
||||
|
||||
// This file holds the per-account allow/deny black-or-white lists (design/16 §4.6
|
||||
// §6) enforced at the head of the inbound pipeline, plus the config readers the
|
||||
// list matching depends on.
|
||||
// 本文件承载按账号的允许/拒绝黑白名单(design/16 §4.6
|
||||
// §6),在入站流水线的最前端执行,并包含名单匹配所依赖的
|
||||
// 配置读取函数。
|
||||
|
||||
// blacklisted applies the per-account allow/deny black-or-white lists (design/16
|
||||
// §4.6 §6) to a non-owner inbound message. Group messages are matched by GroupID
|
||||
// against allowGroups/denyGroups; direct messages are matched by the sender's user
|
||||
// id against allowUsers/denyUsers. An empty allow list means "allow all" (only the
|
||||
// deny list applies); a non-empty allow list becomes a white list. The owner is
|
||||
// never blacklisted (the caller skips this for owner messages).
|
||||
// blacklisted 对非主人的入站消息应用按账号的允许/拒绝黑白名单
|
||||
// (design/16 §4.6 §6)。群消息按 GroupID
|
||||
// 匹配 allowGroups/denyGroups;私聊消息按发送者用户
|
||||
// id 匹配 allowUsers/denyUsers。空的允许名单表示「全部允许」(仅
|
||||
// 拒绝名单生效);非空允许名单即成为白名单。主人
|
||||
// 永不被拉黑(调用方对主人消息跳过本函数)。
|
||||
func (b *Bridge) blacklisted(msg adapter.UnifiedMessage, a adapter.PlatformAdapter) (bool, string) {
|
||||
if a == nil {
|
||||
return false, ""
|
||||
@@ -38,9 +38,9 @@ func (b *Bridge) blacklisted(msg adapter.UnifiedMessage, a adapter.PlatformAdapt
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// channelLists reads the allow/deny string lists off an adapter's Config snapshot.
|
||||
// The lists are stored as plain []string values (set by the multi-account wiring);
|
||||
// an absent key yields an empty list.
|
||||
// channelLists 从适配器的 Config 快照中读取允许/拒绝字符串列表。
|
||||
// 列表以普通 []string 值存储(由多账号装配设置);
|
||||
// 键缺失时得到空列表。
|
||||
func channelLists(cfg map[string]any) (allowGroups, denyGroups, allowUsers, denyUsers []string) {
|
||||
if cfg == nil {
|
||||
return nil, nil, nil, nil
|
||||
@@ -49,8 +49,8 @@ func channelLists(cfg map[string]any) (allowGroups, denyGroups, allowUsers, deny
|
||||
cfgStrings(cfg, "allowUsers"), cfgStrings(cfg, "denyUsers")
|
||||
}
|
||||
|
||||
// cfgStrings reads a []string field from an adapter config map, returning nil when
|
||||
// absent or of a different type.
|
||||
// cfgStrings 从适配器配置 map 中读取 []string 字段,缺失或
|
||||
// 类型不符时返回 nil。
|
||||
func cfgStrings(m map[string]any, key string) []string {
|
||||
if m == nil {
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user