blob: bd71f454a48de2f15eb188a72e7e0e8d9033a929 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
}
|