Documentation ¶
Index ¶
- Constants
- Variables
- func Max(x, y int) int
- func Min(x, y int) int
- func RegisterIrcAndUiHandlers(c *irc.Conn) (quits chan bool, msgs chan *IrcMessage, typings chan string)
- func ReplaceText(input string) string
- func Start(cmd *cobra.Command, args []string)
- type ChatAggregator
- type ChatBox
- type ChatHistory
- type IrcMessage
- type MessageCount
- type MessageRateSparkline
- type MessageStatsChart
- type SlidingWindowCounter
- type SortedMessages
- type UILayoutState
Constants ¶
View Source
const ( Increment = iota Decrement = iota )
updateAction Types
Variables ¶
View Source
var (
IrcServerHost, IrcServerPort, TlsPort, IrcUser, IrcPassword, IrcChannel string
MessageTTL, FilterDuplicateTTL time.Duration
FilterDuplicates bool
)
View Source
var TwitchCmd = &cobra.Command{
Use: "twitch_chat_filter",
Short: "Filters twitch chat stream",
Long: `Aggregates common messages within a given time window`,
}
Functions ¶
func RegisterIrcAndUiHandlers ¶
func RegisterIrcAndUiHandlers(c *irc.Conn) (quits chan bool, msgs chan *IrcMessage, typings chan string)
func ReplaceText ¶
Types ¶
type ChatAggregator ¶
type ChatAggregator struct { TTL time.Duration Widget *ui.List SortedMessages *SortedMessages }
func NewChatAggregator ¶
func NewChatAggregator(textColor ui.Attribute, ttl time.Duration) *ChatAggregator
type ChatBox ¶
func NewChatBox ¶
func NewChatBox(input <-chan string, messages chan<- *IrcMessage, c *irc.Conn) *ChatBox
type ChatHistory ¶
type ChatHistory struct { Widget *ui.List ChatHistoryData []string Size int FilteredMessagesSet *ccache.Cache }
func NewChatHistory ¶
func NewChatHistory() *ChatHistory
func (*ChatHistory) UpdateAndRender ¶
func (self *ChatHistory) UpdateAndRender(msg *IrcMessage)
type IrcMessage ¶
type MessageCount ¶
type MessageRateSparkline ¶
type MessageRateSparkline struct { Widget *ui.Sparkline Counter *SlidingWindowCounter }
func NewMessageRateSparkline ¶
func NewMessageRateSparkline(color ui.Attribute, counter *SlidingWindowCounter) *MessageRateSparkline
func (*MessageRateSparkline) IncrementAndRender ¶
func (self *MessageRateSparkline) IncrementAndRender(sparklines *ui.Sparklines)
type MessageStatsChart ¶
type MessageStatsChart struct { Widget *ui.BarChart Counter *SlidingWindowCounter }
func NewMessageStatsChart ¶
func NewMessageStatsChart(barColor, numColor ui.Attribute, counter *SlidingWindowCounter) *MessageStatsChart
func (*MessageStatsChart) Render ¶
func (self *MessageStatsChart) Render()
type SlidingWindowCounter ¶
type SlidingWindowCounter struct { Data []int Min int Max int Avg int Sum int Stats []int // contains Min, Max, Avg, Sum Window time.Duration NumWindows int }
func NewSlidingWindowCounter ¶
func NewSlidingWindowCounter(timeWindow time.Duration, numWindows int) (*SlidingWindowCounter, error)
func (*SlidingWindowCounter) Increment ¶
func (self *SlidingWindowCounter) Increment()
type SortedMessages ¶
type SortedMessages struct { Data []MessageCount // no size limit View []string // size limit applies ViewSize int ViewCountThreshold int NotifyViewChange chan bool // an element is put in here every time the view changes // contains filtered or unexported fields }
func NewSortedMessages ¶
func NewSortedMessages(size, viewThreshold int) *SortedMessages
type UILayoutState ¶
type UILayoutState struct { Header *ui.Par ChatHistory *ChatHistory ChatBox *ChatBox MinuteStats *MessageStatsChart HourStats *MessageStatsChart MessageRateWidget *ui.Sparklines MinuteMessageRate *MessageRateSparkline HourMessageRate *MessageRateSparkline SecondsChatAggregator *ChatAggregator MinuteChatAggregator *ChatAggregator MessageStream <-chan *IrcMessage IrcConn *irc.Conn }
func NewUILayoutState ¶
func NewUILayoutState() *UILayoutState
func (*UILayoutState) InitBodyAndLoop ¶
func (self *UILayoutState) InitBodyAndLoop()
Click to show internal directories.
Click to hide internal directories.