@@ -89,17 +89,43 @@ func (c *CmdTeamBotSettings) Run() error {
8989 return err
9090 }
9191 }
92- if err := renderBotSettings (c .G (), c .Username , botSettings ); err != nil {
92+ if err := renderBotSettings (c .G (), c .Username , nil , botSettings ); err != nil {
9393 return err
9494 }
9595 return nil
9696}
9797
98- func renderBotSettings (g * libkb.GlobalContext , username string , botSettings keybase1.TeamBotSettings ) error {
98+ func renderBotSettings (g * libkb.GlobalContext , username string , convID * chat1. ConversationID , botSettings keybase1.TeamBotSettings ) error {
9999 var output string
100100 if botSettings .Cmds {
101- // TODO HOTPOT-661 call bot advertise list for public commands, build output
102- output += "\t - command messages\n "
101+ chatClient , err := GetChatLocalClient (g )
102+ if err != nil {
103+ return fmt .Errorf ("Getting chat service client error: %s" , err )
104+ }
105+ var cmds chat1.ListBotCommandsLocalRes
106+ if convID == nil {
107+ cmds , err = chatClient .ListPublicBotCommandsLocal (context .TODO (), username )
108+ if err != nil {
109+ return err
110+ }
111+ } else {
112+ cmds , err = chatClient .ListBotCommandsLocal (context .TODO (), * convID )
113+ if err != nil {
114+ return err
115+ }
116+ }
117+
118+ if len (cmds .Commands ) > 0 {
119+ output += "\t - command messages for the following commands: \n "
120+ } else {
121+ output += "\t - command messages\n "
122+ }
123+ username = libkb .NewNormalizedUsername (username ).String ()
124+ for _ , cmd := range cmds .Commands {
125+ if cmd .Username == username {
126+ output += fmt .Sprintf ("\t \t - !%s\n " , cmd .Name )
127+ }
128+ }
103129 }
104130
105131 if botSettings .Mentions {
0 commit comments