Compare commits

..

No commits in common. "main" and "v0.2" have entirely different histories.
main ... v0.2

2 changed files with 6 additions and 11 deletions

View File

@ -125,7 +125,7 @@ slack:
api_token: SLACK_API_TOKEN api_token: SLACK_API_TOKEN
create_from_weekday: 3 create_from_weekday: 3
default_conversation: SLACK_UID default_conversation: SLACK_UID
sticky_users: sticky_users:
- SLACK_UID - SLACK_UID
``` ```

View File

@ -437,22 +437,17 @@ func CreateSlackChannels() {
// If topic is defined, set the topic and purpose. // If topic is defined, set the topic and purpose.
if topic != "" { if topic != "" {
// Keep count of failures so we can try again. // Sleep before, as it takes time for Slack APIs
failed := 0 // to recongize the channel was created.
_, err = app.slack.SetTopicOfConversation(schan.ID, topic) time.Sleep(120 * time.Second)
_, err = app.slack.SetTopicOfConversation(channel.ID, topic)
if err != nil { if err != nil {
failed++
log.Println("Failed to set topic:", err) log.Println("Failed to set topic:", err)
} }
_, err = app.slack.SetPurposeOfConversation(schan.ID, topic) _, err = app.slack.SetPurposeOfConversation(channel.ID, topic)
if err != nil { if err != nil {
failed++
log.Println("Failed to set purpose:", err) 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. // Save the channel to the database.