Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit dc661a2

Browse files
authored
Merge pull request #59 from keybase/david/update-go-bot-types
Update go-keybase-chat-bot dependency to include generated types
2 parents 4e6be04 + e3f3f7c commit dc661a2

7 files changed

Lines changed: 11 additions & 15 deletions

File tree

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,3 @@ repos:
1414
rev: f16f18866390cba642e8af6073ed59504aeada5c
1515
hooks:
1616
- id: go-mod-tidy
17-
- repo: https://github.com/golangci/golangci-lint
18-
rev: v1.17.1
19-
hooks:
20-
- id: golangci-lint

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.12
44

55
require (
66
github.com/google/uuid v1.1.1
7-
github.com/keybase/go-keybase-chat-bot v0.0.0-20190812134859-bc54fd9cf83b
7+
github.com/keybase/go-keybase-chat-bot v0.0.0-20190903135515-79c56220e558
88
github.com/sirupsen/logrus v1.4.2
99
github.com/stretchr/testify v1.3.0
1010
github.com/urfave/cli v1.21.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
77
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
8-
github.com/keybase/go-keybase-chat-bot v0.0.0-20190812134859-bc54fd9cf83b h1:7Te2f9LQ/rd6XSzpntz6BaCBgglZ0uiCdv3/GdhX9VA=
9-
github.com/keybase/go-keybase-chat-bot v0.0.0-20190812134859-bc54fd9cf83b/go.mod h1:vNc28YFzigVJod0j5EbuTtRIe7swx8vodh2yA4jZ2s8=
8+
github.com/keybase/go-keybase-chat-bot v0.0.0-20190903135515-79c56220e558 h1:iZ1RdFAAftDrkcuYWWNOJt+LBUo8tefd0GywewLuTqE=
9+
github.com/keybase/go-keybase-chat-bot v0.0.0-20190903135515-79c56220e558/go.mod h1:vNc28YFzigVJod0j5EbuTtRIe7swx8vodh2yA4jZ2s8=
1010
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
1111
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
1212
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

src/keybaseca/bot/bot.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func StartBot(conf config.Config) error {
5555
return fmt.Errorf("failed to read message: %v", err)
5656
}
5757

58-
if msg.Message.Content.Type != "text" {
58+
if msg.Message.Content.TypeName != "text" {
5959
continue
6060
}
6161

@@ -83,7 +83,7 @@ func StartBot(conf config.Config) error {
8383
if shared.IsAckRequest(messageBody) {
8484
log.Debug("Responding to AckMessage")
8585
// Ack any AckRequests so that kssh can determine whether it has fully connected
86-
_, err = kbc.SendMessageByConvID(msg.Message.ConversationID, shared.GenerateAckResponse(messageBody))
86+
_, err = kbc.SendMessageByConvID(msg.Message.ConvID, shared.GenerateAckResponse(messageBody))
8787
if err != nil {
8888
LogError(conf, kbc, msg, err)
8989
continue
@@ -108,7 +108,7 @@ func StartBot(conf config.Config) error {
108108
LogError(conf, kbc, msg, err)
109109
continue
110110
}
111-
_, err = kbc.SendMessageByConvID(msg.Message.ConversationID, shared.SignatureResponsePreamble+string(response))
111+
_, err = kbc.SendMessageByConvID(msg.Message.ConvID, shared.SignatureResponsePreamble+string(response))
112112
if err != nil {
113113
LogError(conf, kbc, msg, err)
114114
continue
@@ -122,9 +122,9 @@ func StartBot(conf config.Config) error {
122122
// Log the given error to Keybase chat and to the configured log file. Used so that the chatbot does not crash
123123
// due to an error caused by a malformed message.
124124
func LogError(conf config.Config, kbc *kbchat.API, msg kbchat.SubscriptionMessage, err error) {
125-
message := fmt.Sprintf("Encountered error while processing message from %s (messageID:%d): %v", msg.Message.Sender.Username, msg.Message.MsgID, err)
125+
message := fmt.Sprintf("Encountered error while processing message from %s (messageID:%d): %v", msg.Message.Sender.Username, msg.Message.Id, err)
126126
auditlog.Log(conf, message)
127-
_, e := kbc.SendMessageByConvID(msg.Message.ConversationID, message)
127+
_, e := kbc.SendMessageByConvID(msg.Message.ConvID, message)
128128
if e != nil {
129129
auditlog.Log(conf, fmt.Sprintf("failed to log an error to chat (something is probably very wrong): %v", err))
130130
}

src/keybaseca/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func ValidateConfig(conf EnvConfig, offline bool) error {
7575
}
7676
}
7777
}
78-
log.Debugf("Validated config: %s", conf.DebugString())
78+
log.Debugf("Validated config: %s", conf.DebugString())
7979
return nil
8080
}
8181

src/keybaseca/sshutils/sshutils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func getPrincipals(conf config.Config, sr shared.SignatureRequest) (string, erro
170170
for _, result := range results {
171171
if result.Role != 0 {
172172
// result.Role == 0 means they are an impicit admin in the team and are not actually a member
173-
teamToMembership[result.TeamName] = true
173+
teamToMembership[result.FqName] = true
174174
}
175175
}
176176

src/kssh/bot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func GetSignedKey(config ConfigFile, request shared.SignatureRequest) (shared.Si
6262
return empty, fmt.Errorf("failed to read message: %v", err)
6363
}
6464

65-
if msg.Message.Content.Type != "text" {
65+
if msg.Message.Content.TypeName != "text" {
6666
continue
6767
}
6868

0 commit comments

Comments
 (0)