1
0
mirror of https://github.com/Rudi9719/kbtui.git synced 2026-03-22 08:47:24 +00:00

Handle invalid channel error

This commit is contained in:
2019-09-25 21:45:43 -04:00
parent cf1ae3e314
commit 525ce827b8

View File

@ -52,7 +52,7 @@ func populateChat(g *gocui.Gui) {
chat := k.NewChat(channel) chat := k.NewChat(channel)
maxX, _ := g.Size() maxX, _ := g.Size()
if api, err := chat.Read(maxX / 2); err != nil { if api, err := chat.Read(maxX / 2); err != nil {
log.Printf("%+v", err) printToView(g, "Feed", fmt.Sprintf("%+v", err))
} else { } else {
var printMe []string var printMe []string
var actuallyPrintMe string var actuallyPrintMe string
@ -308,6 +308,7 @@ func handleMessage(api keybase.ChatAPI, g *gocui.Gui) {
func reactToMessage(reaction string) { func reactToMessage(reaction string) {
chat := k.NewChat(channel) chat := k.NewChat(channel)
chat.React(lastMessage.ID, reaction) chat.React(lastMessage.ID, reaction)
} }
func handleInput(g *gocui.Gui) error { func handleInput(g *gocui.Gui) error {
inputString, _ := getInputString(g) inputString, _ := getInputString(g)
@ -325,14 +326,14 @@ func handleInput(g *gocui.Gui) error {
channel.MembersType = keybase.TEAM channel.MembersType = keybase.TEAM
channel.Name = command[1] channel.Name = command[1]
channel.TopicName = command[2] channel.TopicName = command[2]
printToView(g, "Feed", fmt.Sprintf("You have joined: @%s#%s", channel.Name, channel.TopicName)) printToView(g, "Feed", fmt.Sprintf("You are joining: @%s#%s", channel.Name, channel.TopicName))
clearView(g, "Chat") clearView(g, "Chat")
go populateChat(g) go populateChat(g)
} else if len(command) == 2 { } else if len(command) == 2 {
channel.MembersType = keybase.USER channel.MembersType = keybase.USER
channel.Name = command[1] channel.Name = command[1]
channel.TopicName = "" channel.TopicName = ""
printToView(g, "Feed", fmt.Sprintf("You have joined: @%s", channel.Name)) printToView(g, "Feed", fmt.Sprintf("You are joining: @%s", channel.Name))
clearView(g, "Chat") clearView(g, "Chat")
go populateChat(g) go populateChat(g)
} else { } else {