Fix send message as user
This commit is contained in:
parent
a0603698f9
commit
d59bbced84
3
TODO.md
3
TODO.md
@ -4,9 +4,9 @@ Bugs:
|
||||
channel, the Buffer() in Chat will probably not go further than the
|
||||
latest message. Could be that items are added to List and not cleared
|
||||
when switching channels
|
||||
- [x] send message as user, now it will send it as a bot
|
||||
- [ ] GetMessages for a channel can result in `json: cannot unmarshal number
|
||||
into Go value of type string` https://github.com/nlopes/slack/issues/92
|
||||
- [ ] send message as user, now it will send it as a bot
|
||||
- [ ] alot of usernames 'unknown' should be a better way to uncover this
|
||||
- [ ] uncovering usernames takes too long, should find a better way
|
||||
- [ ] docs at exported functions
|
||||
@ -19,4 +19,5 @@ Features:
|
||||
|
||||
- [ ] scrolling in chat pane
|
||||
- [ ] scrolling in channel pane
|
||||
- [ ] private chats
|
||||
- [x] channel name in chat pane
|
||||
|
@ -62,8 +62,8 @@ func (i *Input) SetY(y int) {
|
||||
i.Par.SetY(y)
|
||||
}
|
||||
|
||||
func (i *Input) SendMessage(svc *service.SlackService, channel string, user string, message string) {
|
||||
svc.SendMessage(channel, user, message)
|
||||
func (i *Input) SendMessage(svc *service.SlackService, channel string, message string) {
|
||||
svc.SendMessage(channel, message)
|
||||
}
|
||||
|
||||
// Insert will insert a given key at the place of the current CursorPosition
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
|
||||
type Config struct {
|
||||
SlackToken string `json:"slack_token"`
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
||||
func NewConfig(filepath string) (*Config, error) {
|
||||
|
@ -157,7 +157,6 @@ func actionSend(ctx *context.AppContext) {
|
||||
ctx.View.Input.SendMessage(
|
||||
ctx.Service,
|
||||
ctx.View.Channels.SlackChannels[ctx.View.Channels.SelectedChannel].ID,
|
||||
ctx.Config.User,
|
||||
ctx.View.Input.Text(),
|
||||
)
|
||||
ctx.View.Input.Clear()
|
||||
|
@ -52,10 +52,10 @@ func (s *SlackService) GetChannels() []Channel {
|
||||
return chans
|
||||
}
|
||||
|
||||
func (s *SlackService) SendMessage(channel string, user string, message string) {
|
||||
func (s *SlackService) SendMessage(channel string, message string) {
|
||||
// https://godoc.org/github.com/nlopes/slack#PostMessageParameters
|
||||
postParams := slack.PostMessageParameters{
|
||||
Username: user,
|
||||
AsUser: true,
|
||||
}
|
||||
|
||||
// https://godoc.org/github.com/nlopes/slack#Client.PostMessage
|
||||
|
Loading…
Reference in New Issue
Block a user