You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funchandleMsgFromSlack(event*slack.MessageEvent) {
user, err:=slackClient.GetUserInfo(event.User)
attachment:= slack.Attachment{
Pretext: "Hello @"+user.Name+"",
Text: "I am happy to see you here!",
Fields: []slack.AttachmentField{
slack.AttachmentField{
Title: "Title of the attachment",
Value: "This is the body",
},
},
}
channelID, timestamp, err:=slackClient.PostMessage(
event.User,
slack.MsgOptionText("Hello there!", true),
slack.MsgOptionAttachments(attachment),
)
iferr!=nil {
fmt.Printf("Ooops! There is an error: %s\n", err)
return
}
fmt.Printf("Message successfully sent to channel %s at %s", channelID, timestamp)
}
The above codes work, but in a wrong way; When a user sends a message to the bot, it replies using the default slackbot. The response is not coming via the bot itself. I think that's bug.
The text was updated successfully, but these errors were encountered:
Here are my codes of handling MessageEvent:
The above codes work, but in a wrong way; When a user sends a message to the bot, it replies using the default
slackbot
. The response is not coming via the bot itself. I think that's bug.The text was updated successfully, but these errors were encountered: