Skip to content

Commit

Permalink
feat: include timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Mar 3, 2024
1 parent 9dae3f4 commit e394451
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion handler/message/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/golang-lru/v2/expirable"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/timestamppb"
"io"
"log/slog"
"strconv"
Expand All @@ -43,11 +44,12 @@ const (
FileTypeVideo
)

const attrValType = "com.github.awakari.source-telegram"
const attrValType = "com.github.awakari.source-telegram.v1"
const attrValSpecVersion = "1.0"
const attrKeyLatitude = "latitude"
const attrKeyLongitude = "longitude"
const attrKeyMsgId = "tgmessageid"
const attrKeyTime = "time"

// file attrs
const attrKeyFileId = "tgfileid"
Expand Down Expand Up @@ -133,6 +135,11 @@ func (h msgHandler) convertToEvent(chanId int64, msg *client.Message) (evt *pb.C
CeString: strconv.FormatInt(msg.Id, 10),
},
},
attrKeyTime: {
Attr: &pb.CloudEventAttributeValue_CeTimestamp{
CeTimestamp: timestamppb.New(time.Unix(int64(msg.Date), 0)),
},
},
},
}
switch content.MessageContentType() {
Expand Down

0 comments on commit e394451

Please sign in to comment.