mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-09-26 19:41:17 +08:00
Display the event type if it's not a chat message
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package streamcontrol
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ChatUserID string
|
||||
type ChatMessageID string
|
||||
@@ -32,3 +35,35 @@ const (
|
||||
EventTypeStreamOffline
|
||||
EventTypeOther
|
||||
)
|
||||
|
||||
func (t EventType) String() string {
|
||||
switch t {
|
||||
case EventTypeUndefined:
|
||||
return "undefined"
|
||||
case EventTypeChatMessage:
|
||||
return "chat_message"
|
||||
case EventTypeCheer:
|
||||
return "cheer"
|
||||
case EventTypeAutoModHold:
|
||||
return "automod_hold"
|
||||
case EventTypeAdBreak:
|
||||
return "ad_break"
|
||||
case EventTypeBan:
|
||||
return "ban"
|
||||
case EventTypeFollow:
|
||||
return "follow"
|
||||
case EventTypeRaid:
|
||||
return "raid"
|
||||
case EventTypeChannelShoutoutReceive:
|
||||
return "channel_shoutout_receive"
|
||||
case EventTypeSubscribe:
|
||||
return "subscribe"
|
||||
case EventTypeStreamOnline:
|
||||
return "stream_online"
|
||||
case EventTypeStreamOffline:
|
||||
return "stream_offline"
|
||||
case EventTypeOther:
|
||||
return "other"
|
||||
}
|
||||
return fmt.Sprintf("unknown_%d", int(t))
|
||||
}
|
||||
|
@@ -351,7 +351,11 @@ func (ui *chatUIAsList) listUpdateItem(
|
||||
removeMsgButton.Enable()
|
||||
}
|
||||
}
|
||||
item.TimestampSegment.Text = msg.CreatedAt.Format("15:04:05")
|
||||
newText := msg.CreatedAt.Format("05")
|
||||
if msg.EventType != streamcontrol.EventTypeChatMessage {
|
||||
newText += fmt.Sprintf(" %s", msg.EventType.String())
|
||||
}
|
||||
item.TimestampSegment.Text = newText
|
||||
item.TimestampSegment.Style.ColorName = colorForPlatform(msg.Platform)
|
||||
item.UsernameSegment.Text = msg.Username
|
||||
item.UsernameSegment.Style.ColorName = colorForUsername(msg.Username)
|
||||
|
@@ -307,7 +307,11 @@ func (ui *chatUIAsText) newItem(
|
||||
removeMsgButton.Enable()
|
||||
}
|
||||
}
|
||||
item.TimestampSegment.Text = msg.CreatedAt.Format("15:04:05")
|
||||
newText := msg.CreatedAt.Format("05")
|
||||
if msg.EventType != streamcontrol.EventTypeChatMessage {
|
||||
newText += fmt.Sprintf(" %s", msg.EventType.String())
|
||||
}
|
||||
item.TimestampSegment.Text = newText
|
||||
item.TimestampSegment.Style.ColorName = colorForPlatform(msg.Platform)
|
||||
item.UsernameSegment.Text = msg.Username
|
||||
item.UsernameSegment.Style.ColorName = colorForUsername(msg.Username)
|
||||
|
Reference in New Issue
Block a user