mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-09-27 03:45:52 +08:00
Add readable username in Thrift output
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamcontrol"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamd/api"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamd/grpc/go/streamd_grpc"
|
||||
"github.com/xaionaro-go/streamctl/pkg/xstring"
|
||||
)
|
||||
|
||||
func ChatMessageGo2GRPC(
|
||||
@@ -18,6 +19,7 @@ func ChatMessageGo2GRPC(
|
||||
EventType: PlatformEventTypeGo2GRPC(event.EventType),
|
||||
UserID: string(event.UserID),
|
||||
Username: event.Username,
|
||||
UsernameReadable: xstring.ToReadable(event.Username),
|
||||
MessageID: string(event.MessageID),
|
||||
Message: event.Message,
|
||||
}
|
||||
|
@@ -798,6 +798,7 @@ message ChatMessage {
|
||||
string username = 6;
|
||||
string messageID = 7;
|
||||
string message = 8;
|
||||
string usernameReadable = 9;
|
||||
}
|
||||
|
||||
message SendChatMessageRequest {
|
||||
|
@@ -11,7 +11,6 @@ func ToReadable(s string) string {
|
||||
plain := norm.NFKD.String(s)
|
||||
var b strings.Builder
|
||||
for _, r := range plain {
|
||||
// Remove symbols (unicode.Symbol), keep everything else (including foreign letters)
|
||||
if !unicode.IsSymbol(r) {
|
||||
b.WriteRune(r)
|
||||
}
|
||||
|
Reference in New Issue
Block a user