diff options
| author | Castor Regex <[email protected]> | 2025-08-24 13:07:43 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-24 13:07:43 -0500 |
| commit | b03889101d81b1b6c79f627a22dca7569cb14ad6 (patch) | |
| tree | 70d6be20c1da7b744ae6d399ab3dc99ed7a96336 /doNewChat.go | |
| parent | 1a6b3671443c86ced2f7143116b3f8ff7206cef5 (diff) | |
feat(chat): add --new-chat and --count-auto flags
Diffstat (limited to 'doNewChat.go')
| -rw-r--r-- | doNewChat.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doNewChat.go b/doNewChat.go new file mode 100644 index 0000000..bd71f45 --- /dev/null +++ b/doNewChat.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + + "go.wit.com/lib/protobuf/chatpb" + "go.wit.com/log" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func doNewChat() { + if len(argv.NewChat) != 2 { + log.Error(fmt.Errorf("expected 2 arguments for --new-chat")) + return + } + uuid := argv.NewChat[0] + topic := argv.NewChat[1] + + chat := &chatpb.Chat{ + Uuid: uuid, + ChatName: topic, + Ctime: timestamppb.Now(), + } + + me.chats.Chats = append(me.chats.Chats, chat) + me.chats.ConfigSave() + log.Info("created new chat for", uuid) +} |
