ScuttleBot

feat(bridge): use IRCv3 account-tag and server-time in PRIVMSG handler Read account-tag from girc.Event.Tags for sender identity instead of relying on source nick. Fall back to e.Source.Name when tag is absent. Use e.Timestamp (populated from server-time cap) instead of time.Now() for accurate message timestamps. Both capabilities are already negotiated by girc by default — no config changes needed. Closes #112 (Phase 1 — bridge bot)

lmata 2026-04-04 19:44 trunk
Commit fa8ae5bdc5e18894e5d214b19c5f0a6a45426c15ad40828c9f0a2ad41414191d
--- internal/bots/bridge/bridge.go
+++ internal/bots/bridge/bridge.go
@@ -204,14 +204,20 @@
204204
}
205205
channel := e.Params[0]
206206
if !strings.HasPrefix(channel, "#") {
207207
return // ignore DMs
208208
}
209
+ // Prefer account-tag (IRCv3) over source nick for sender identity.
210
+ nick := e.Source.Name
211
+ if acct, ok := e.Tags.Get("account"); ok && acct != "" {
212
+ nick = acct
213
+ }
214
+
209215
b.dispatch(Message{
210
- At: time.Now(),
216
+ At: e.Timestamp,
211217
Channel: channel,
212
- Nick: e.Source.Name,
218
+ Nick: nick,
213219
Text: e.Last(),
214220
})
215221
})
216222
217223
b.client = c
218224
--- internal/bots/bridge/bridge.go
+++ internal/bots/bridge/bridge.go
@@ -204,14 +204,20 @@
204 }
205 channel := e.Params[0]
206 if !strings.HasPrefix(channel, "#") {
207 return // ignore DMs
208 }
 
 
 
 
 
 
209 b.dispatch(Message{
210 At: time.Now(),
211 Channel: channel,
212 Nick: e.Source.Name,
213 Text: e.Last(),
214 })
215 })
216
217 b.client = c
218
--- internal/bots/bridge/bridge.go
+++ internal/bots/bridge/bridge.go
@@ -204,14 +204,20 @@
204 }
205 channel := e.Params[0]
206 if !strings.HasPrefix(channel, "#") {
207 return // ignore DMs
208 }
209 // Prefer account-tag (IRCv3) over source nick for sender identity.
210 nick := e.Source.Name
211 if acct, ok := e.Tags.Get("account"); ok && acct != "" {
212 nick = acct
213 }
214
215 b.dispatch(Message{
216 At: e.Timestamp,
217 Channel: channel,
218 Nick: nick,
219 Text: e.Last(),
220 })
221 })
222
223 b.client = c
224

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button