Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imrpove bot commands logging #20843

Merged
merged 1 commit into from Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions go/chat/bots/commands.go
Expand Up @@ -235,12 +235,14 @@ func (b *CachingBotCommandManager) ListCommands(ctx context.Context, convID chat
return nil, nil
}
if s.Version != storageVersion {
b.Debug(ctx, "ListCommands: deleting old version %d vs %d", s.Version, storageVersion)
if err := b.edb.Delete(ctx, dbKey); err != nil {
b.Debug(ctx, "edb.Delete: %v", err)
}
return nil, nil
}
cmdDedup := make(map[string]bool)

for _, ad := range s.Advertisements {
// If the advertisement is by a restricted bot that will not be keyed
// for commands, filter the advertisement out.
Expand All @@ -250,6 +252,7 @@ func (b *CachingBotCommandManager) ListCommands(ctx context.Context, convID chat
return nil, err
}
if !teamBotSettings[keybase1.UID(ad.UID.String())].Cmds {
b.Debug(ctx, "ListCommands: skipping commands from %v, a restricted bot without cmds", ad.UID)
continue
}
}
Expand Down Expand Up @@ -348,6 +351,7 @@ func (b *CachingBotCommandManager) queueCommandUpdate(ctx context.Context, job c
}

func (b *CachingBotCommandManager) getBotInfo(ctx context.Context, job commandUpdaterJob) (botInfo chat1.BotInfo, doUpdate bool, err error) {
defer b.Trace(ctx, func() error { return err }, fmt.Sprintf("getBotInfo: %v", job.convID))()
if job.info != nil {
return *job.info, true, nil
}
Expand Down
2 changes: 1 addition & 1 deletion go/chat/sender.go
Expand Up @@ -884,7 +884,7 @@ func (s *BlockingSender) applyTeamBotSettings(ctx context.Context, uid gregor1.U
if err != nil {
return nil, err
}
s.Debug(ctx, "applying botSettings: %+v for botuid: %v, senderUID: %v, isMatch: %v",
s.Debug(ctx, "applyTeamBotSettings: applied settings for %+v for botuid: %v, senderUID: %v, isMatch: %v",
botSettings, uv.Uid, msg.ClientHeader.Sender, isMatch)
// If the bot is the sender encrypt only for them.
if msg.ClientHeader.Sender.Eq(botUID) {
Expand Down