Update protocol/message.go

Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
This commit is contained in:
Andrea Maria Piana 2020-07-16 08:21:02 +02:00
parent bdb2708a39
commit 4ae2c59e9b
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 5 additions and 3 deletions

View File

@ -262,7 +262,7 @@ func (m *Message) parseImage() error {
}
// parseAudio check the message contains an audio, and if so
// it creates the a base64 encoded version of it.
// it creates a base64 encoded version of it.
func (m *Message) parseAudio() error {
if m.ContentType != protobuf.ChatMessage_AUDIO {
return nil

View File

@ -1400,11 +1400,13 @@ func (m *Messenger) SendChatMessage(ctx context.Context, message *Message) (*Mes
if audioMessage == nil {
return nil, errors.New("no audio has been passed")
}
m.logger.Info("Audio", zap.Any("audio", audioMessage))
m.logger.Info("Duration", zap.Uint64("duration", audioMessage.DurationMs))
audioMessage.Payload = payload
audioMessage.Type = audio.Type(payload)
message.Payload = &protobuf.ChatMessage_Audio{Audio: audioMessage}
err = os.Remove(message.AudioPath)
if err != nil {
return nil, err
}
}
logger := m.logger.With(zap.String("site", "Send"), zap.String("chatID", message.ChatId))