parent
6a15950505
commit
6c2ac43bda
4
Makefile
4
Makefile
@ -47,4 +47,6 @@ build-mac:
|
||||
run: build
|
||||
./bin/slack-term
|
||||
|
||||
.PHONY: default test build run
|
||||
build-all: build build-linux build-mac
|
||||
|
||||
.PHONY: default test build build-linux build-mac run
|
||||
|
@ -85,8 +85,11 @@ func incomingMessageHandler(ctx *context.AppContext) {
|
||||
// Set new message indicator for channel, I'm leaving
|
||||
// this here because I also want to be notified when
|
||||
// I'm currently in a channel but not in the terminal
|
||||
// window (tmux)
|
||||
actionNewMessage(ctx, ev.Channel)
|
||||
// window (tmux). But only create a notification when
|
||||
// it comes from someone else but the current user.
|
||||
if ev.User != ctx.Service.CurrentUserID {
|
||||
actionNewMessage(ctx, ev.Channel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ type SlackService struct {
|
||||
SlackChannels []interface{}
|
||||
Channels []Channel
|
||||
UserCache map[string]string
|
||||
CurrentUserID string
|
||||
}
|
||||
|
||||
type Channel struct {
|
||||
@ -41,6 +42,15 @@ func NewSlackService(token string) *SlackService {
|
||||
svc.UserCache[user.ID] = user.Name
|
||||
}
|
||||
|
||||
// Get user associated with token, mainly
|
||||
// used to identify user when new messages
|
||||
// arrives
|
||||
authTest, err := svc.Client.AuthTest()
|
||||
if err != nil {
|
||||
log.Fatal("Client.AuthTest() failed")
|
||||
}
|
||||
svc.CurrentUserID = authTest.UserID
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user