Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b6777746e4 | |||
dd0cab8a9d |
@ -125,7 +125,7 @@ slack:
|
||||
api_token: SLACK_API_TOKEN
|
||||
create_from_weekday: 3
|
||||
default_conversation: SLACK_UID
|
||||
sticky_users:
|
||||
sticky_users:
|
||||
- SLACK_UID
|
||||
|
||||
```
|
15
update.go
15
update.go
@ -437,17 +437,22 @@ func CreateSlackChannels() {
|
||||
|
||||
// If topic is defined, set the topic and purpose.
|
||||
if topic != "" {
|
||||
// Sleep before, as it takes time for Slack APIs
|
||||
// to recongize the channel was created.
|
||||
time.Sleep(120 * time.Second)
|
||||
_, err = app.slack.SetTopicOfConversation(channel.ID, topic)
|
||||
// Keep count of failures so we can try again.
|
||||
failed := 0
|
||||
_, err = app.slack.SetTopicOfConversation(schan.ID, topic)
|
||||
if err != nil {
|
||||
failed++
|
||||
log.Println("Failed to set topic:", err)
|
||||
}
|
||||
_, err = app.slack.SetPurposeOfConversation(channel.ID, topic)
|
||||
_, err = app.slack.SetPurposeOfConversation(schan.ID, topic)
|
||||
if err != nil {
|
||||
failed++
|
||||
log.Println("Failed to set purpose:", err)
|
||||
}
|
||||
// If it failed, make topic empty so we can try again next run.
|
||||
if failed != 0 {
|
||||
topic = ""
|
||||
}
|
||||
}
|
||||
|
||||
// Save the channel to the database.
|
||||
|
Loading…
x
Reference in New Issue
Block a user