proper hashtag streaming
This commit is contained in:
parent
ca34330599
commit
0b3bf1cd5f
4
main.go
4
main.go
|
@ -178,7 +178,7 @@ func (s *Server) HandleConn(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
err = s.stream(ctx, target, "hashtag", target)
|
||||
err = s.stream(ctx, target, "hashtag", target[1:])
|
||||
if err != nil {
|
||||
ln.Error(err, s.F(), ln.F{"action": "hashtag_stream", "hashtag": target})
|
||||
}
|
||||
|
@ -207,6 +207,7 @@ func (s *Server) stream(ctx context.Context, chName, streamName, hashtag string)
|
|||
s.iw.Writef(":%s JOIN %s", s.nickname, chName)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
|
@ -222,6 +223,7 @@ func (s *Server) stream(ctx context.Context, chName, streamName, hashtag string)
|
|||
s.iw.Writef(":%s PRIVMSG %s :%s: %s%s", streamName, chName, st.Account.Username, st.SpoilerText+" ", strings.Replace(st.Content, "\n", " ", 0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue