setting icon_url and thread_ts together and executing PostMessage disables icon_url
What happend
I made the following code to change the avatar and username replying in Thread. but it was changed only username. avatar was still default of slack-app.
msgOption := slack.MsgOptionCompose(
slack.MsgOptionTS(replyThreadTimestamp),
slack.MsgOptionBroadcast(),
slack.MsgOptionUsername("foouser"),
slack.MsgOptionIconURL("https://some.png"),
slack.MsgOptionText("test", true),
slack.MsgOptionAsUser(false),
)
slack.New(config.BotToken).PostMessage(
config.ChannelID,
msgOption,
)
I noticed that the avatar would change if it wasn't a Thread reply.
i.e. I comment out Msg OptionTS, it successed.
msgOption := slack.MsgOptionCompose(
//slack.MsgOptionTS("replyThreadTimestamp"),
slack.MsgOptionBroadcast(),
slack.MsgOptionUsername("foouser"),
slack.MsgOptionIconURL("https://some.png"),
slack.MsgOptionText("test", true),
slack.MsgOptionAsUser(false),
)
I also recognize it as a go-slack issue, because I've confirmed that using curl, I can change bot's avatar and reply with thread.
curl -XPOST -d "thread_ts=xxx.xxx" -d "token=xx" -d "channel=#xxx" -d "text=xxx" -d "username=xxxx" -d "icon_url=https://some.png" "https://slack.com/api/chat.postMessage"
Expected behavior
I expect to be able to change the avatar even in Thread replying
Steps to reproduce
it will be happen by creating an MsgOption that includes MsgOptionTS and MsgOptionIconURL together.
Versions
- Go: go version go1.15.6 darwin/amd64
- slack-go/slack: v0.8.2
I noticed, if i comment out slack.MsgOptionBroadcast() it succeed to change the avatar and username replying in thread.
msgOption := slack.MsgOptionCompose(
slack.MsgOptionTS("replyThreadTimestamp"),
//slack.MsgOptionBroadcast(),
slack.MsgOptionUsername("foouser"),
slack.MsgOptionIconURL("https://some.png"),
slack.MsgOptionText("test", true),
slack.MsgOptionAsUser(false),
)
but I want to use Broadcast with.
Thank you for reporting. I'll confirm later.