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
-**ActionName**: Sets the action name used by the plugin to identify which action is taken by a user.
79
80
-**ActionSuccessfulMessage**: Message posted after the user takes this action and joins the specified channels.
80
81
-**ChannelsAddedTo**: List of channel names the user is added to. Must be the channel handle used in the URL, in lowercase. For example, in the following URL the **channel name** value is `my-channel`: https://example.com/my-team/channels/my-channel
82
+
-**ActionDirectMessagePost**: The post to send users when creating the bot direct message channel
81
83
82
84
The preview of the configured messages, as well as the creation of a channel welcome message, can be done via bot commands:
p.API.LogError("Couldn't create or get DM channel, continuing to next channel", "user_id", action.Context.UserID, "channelName", channelName, "channel_id", dmChannel.Id)
252
+
return
253
+
}
254
+
255
+
dmMessage:="Welcome to the team!"
256
+
iflen(action.Context.DirectMessagePost) !=0 {
257
+
dmMessage=action.Context.DirectMessagePost
258
+
}
259
+
260
+
post:=&model.Post{
261
+
Message: dmMessage,
262
+
ChannelId: dmChannel.Id,
263
+
UserId: dmUser.Id,
264
+
}
265
+
266
+
if_, err:=p.API.CreatePost(post); err!=nil {
267
+
p.API.LogError(
268
+
"Could not create direct message post",
269
+
"user_id", post.UserId,
270
+
"err", err.Error(),
271
+
)
272
+
}
273
+
} else { // Otherwise treat it like a normal channel
p.API.LogError("Couldn't add user to the channel, continuing to next channel", "channel_name", channelName, "user_id", action.Context.UserID, channel.Id)
277
+
return
278
+
}
279
+
} else {
280
+
p.API.LogError("failed to get channel, continuing to the next channel", "channel_name", channelName, "user_id", action.Context.UserID)
234
281
return
235
282
}
236
-
} else {
237
-
p.API.LogError("failed to get channel, continuing to the next channel", "channel_name", channelName, "user_id", action.Context.UserID)
0 commit comments