Skip to content

Commit b08d0e2

Browse files
committed
update how to get the channelid
1 parent caae53f commit b08d0e2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

standup/standup.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ func AskStandupYesterdayScheduled(s *common.Slack, userid string) error {
139139
"uuid": uuid,
140140
}).Info("Standup uuid generated")
141141

142-
_, _, channelid, err := s.Client.OpenIMChannel(userid)
142+
params := &slack.OpenConversationParameters{
143+
Users: []string{userid},
144+
}
145+
146+
channelid, _, _, err := s.Client.OpenConversation(params)
143147
if err != nil {
144148
log.WithError(err).Error("OpenIMChannel could not get channel id")
145149
}
@@ -150,8 +154,8 @@ func AskStandupYesterdayScheduled(s *common.Slack, userid string) error {
150154
CallbackID: fmt.Sprintf("standupYesterday_%s", userid),
151155
}
152156

153-
params := slack.MsgOptionAttachments(attachment)
154-
_, timestamp, err := s.Client.PostMessage(channelid, params)
157+
params2 := slack.MsgOptionAttachments(attachment)
158+
_, timestamp, err := s.Client.PostMessage(channelid.ID, params2)
155159
if err != nil {
156160
log.WithError(err).Error("Failed to post yesterday standup question")
157161
}
@@ -165,7 +169,7 @@ loop:
165169
for {
166170
select {
167171
case <-timer.C:
168-
err = postStandupCancelTimeout(s, channelid)
172+
err = postStandupCancelTimeout(s, channelid.ID)
169173
if err != nil {
170174
log.WithError(err).Error("Could not cancel standup")
171175
}
@@ -176,7 +180,7 @@ loop:
176180
params2 := &slack.GetConversationHistoryParameters{
177181
Limit: 1,
178182
Oldest: timestamp,
179-
ChannelID: channelid,
183+
ChannelID: channelid.ID,
180184
}
181185

182186
history, err := s.Client.GetConversationHistory(params2)
@@ -201,7 +205,7 @@ loop:
201205
stamp := history.Messages[0].Msg.Timestamp
202206
switch text {
203207
case "cancel":
204-
err = postStandupCancel(s, channelid)
208+
err = postStandupCancel(s, channelid.ID)
205209
if err != nil {
206210
log.WithError(err).Error("Could not cancel standup")
207211
}
@@ -215,7 +219,7 @@ loop:
215219
}
216220
log.Info("Starting yesterdayRegister")
217221

218-
err = askStandupToday(s, channelid, userid, date, times, uuid)
222+
err = askStandupToday(s, channelid.ID, userid, date, times, uuid)
219223
if err != nil {
220224
log.WithError(err).Error("Could not start askStandupToday")
221225
}

0 commit comments

Comments
 (0)