Adopted @42wim's suggestions.

This commit is contained in:
Patrick Connolly
2018-11-07 13:28:52 +08:00
parent a82621f272
commit dda2146718
3 changed files with 8 additions and 11 deletions

View File

@@ -256,8 +256,6 @@ func (b *Bslack) handleTypingEvent(ev *slack.UserTypingEvent) (*config.Message,
Channel: channelInfo.Name,
Account: b.Account,
Event: config.EVENT_USER_TYPING,
ID: "slack " + time.Now().String(),
Extra: map[string][]interface{}{},
}
return &rmsg, nil

View File

@@ -265,17 +265,16 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) {
}
func (b *Bslack) sendRTM(msg config.Message) (string, error) {
if msg.Event == config.EVENT_USER_TYPING && b.GetBool("ShowUserTyping") {
if b.GetBool("ShowUserTyping") {
chanID := b.channelsByName[msg.Channel].ID
b.rtm.SendMessage(b.rtm.NewTypingMessage(chanID))
}
return "", nil
}
channelInfo, err := b.getChannel(msg.Channel)
if err != nil {
return "", fmt.Errorf("could not send message: %v", err)
}
if msg.Event == config.EVENT_USER_TYPING {
if b.GetBool("ShowUserTyping") {
b.rtm.SendMessage(b.rtm.NewTypingMessage(channelInfo.ID))
}
return "", nil
}
// Delete message
if msg.Event == config.EVENT_MSG_DELETE {

View File

@@ -668,8 +668,8 @@ PreserveThreading=false
#Enable showing "user_typing" events from across gateway when available.
#Hint: Set your bot/user's "Full Name" to be "Someone",
#and so the message will say "Someone is typing".
#OPTIONAL (default true)
ShowUserTyping=true
#OPTIONAL (default false)
ShowUserTyping=false
###################################################################
#discord section