Browse Source

Update helptext + download?

pull/1/head
Gregory Rudolph 5 years ago
parent
commit
898b6369aa
  1. 9
      cmdDownload.go
  2. 2
      cmdHelp.go
  3. 2
      cmdJoin.go
  4. 2
      cmdReact.go
  5. 3
      cmdStream.go
  6. 2
      cmdUploadFile.go
  7. 2
      main.go

9
cmdDownload.go

@ -10,7 +10,7 @@ import (
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"download", "d"}, Cmd: []string{"download", "d"},
Description: "Download a file", Description: "/d $messageId $fileName - Download a file to user's downloadpath",
Help: "", Help: "",
Exec: cmdDownloadFile, Exec: cmdDownloadFile,
} }
@ -20,7 +20,12 @@ func init() {
func cmdDownloadFile(cmd []string) { func cmdDownloadFile(cmd []string) {
messageID, _ := strconv.Atoi(cmd[1]) messageID, _ := strconv.Atoi(cmd[1])
fileName := cmd[2] var fileName string
if len(cmd) == 3 {
fileName = cmd[2]
} else {
fileName = ""
}
chat := k.NewChat(channel) chat := k.NewChat(channel)
_, err := chat.Download(messageID, fmt.Sprintf("%s/%s", downloadPath, fileName)) _, err := chat.Download(messageID, fmt.Sprintf("%s/%s", downloadPath, fileName))

2
cmdHelp.go

@ -10,7 +10,7 @@ import (
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"help", "h"}, Cmd: []string{"help", "h"},
Description: "Show information about avaailable commands", Description: "/h Show information about available commands",
Help: "", Help: "",
Exec: cmdHelp, Exec: cmdHelp,
} }

2
cmdJoin.go

@ -11,7 +11,7 @@ import (
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"join", "j"}, Cmd: []string{"join", "j"},
Description: "Join a channel", Description: "/j $team/user $channel - Join a chat, $user or $team $channel",
Help: "", Help: "",
Exec: cmdJoin, Exec: cmdJoin,
} }

2
cmdReact.go

@ -7,7 +7,7 @@ import "strconv"
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"react", "r", "+"}, Cmd: []string{"react", "r", "+"},
Description: "React to a message", Description: "/r $messageId $reaction - React to a message (messageID is optional)",
Help: "", Help: "",
Exec: cmdReact, Exec: cmdReact,
} }

3
cmdStream.go

@ -2,11 +2,10 @@
package main package main
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"stream", "s"}, Cmd: []string{"stream", "s"},
Description: "Stream all incoming messages", Description: "/s - Stream all incoming messages",
Help: "", Help: "",
Exec: cmdStream, Exec: cmdStream,
} }

2
cmdUploadFile.go

@ -9,7 +9,7 @@ import (
func init() { func init() {
command := Command{ command := Command{
Cmd: []string{"upload", "u"}, Cmd: []string{"upload", "u"},
Description: "Upload a file", Description: "/u $filePath $fileName - Upload file with optional name",
Help: "", Help: "",
Exec: cmdUploadFile, Exec: cmdUploadFile,
} }

2
main.go

@ -110,8 +110,6 @@ func formatOutput(api keybase.ChatAPI) string {
return ret return ret
} }
func populateList() { func populateList() {
_, maxY := g.Size() _, maxY := g.Size()
if testVar, err := k.ChatList(); err != nil { if testVar, err := k.ChatList(); err != nil {

Loading…
Cancel
Save