proper hashtag streaming

This commit is contained in:
Cadey Ratio 2017-05-10 17:43:53 -07:00
parent ca34330599
commit 0b3bf1cd5f
1 changed files with 15 additions and 13 deletions

View File

@ -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