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
? `:wave: Hey! A new coffee chat pairing just went out in *#${channelName}*, but you asked to skip this round. You'll automatically be included in the next pairing on ${nextPairingDate.format("MMMM Do")}. :calendar:`
1110
+
: `:wave: Hey! A new coffee chat pairing just went out in *#${channelName}*, but you're currently opted out so you weren't included. Click below if you'd like to rejoin future rounds!`;
1111
+
1112
+
try{
1113
+
constdm=awaitslackbot.client.conversations.open({
1114
+
users: pref.userId,
1115
+
});
1116
+
1117
+
if(!dm.ok||!dm.channel?.id){
1118
+
logWithTime(`Failed to open DM with excluded user ${pref.userId}`);
1119
+
return;
1120
+
}
1121
+
1122
+
awaitslackbot.client.chat.postMessage({
1123
+
channel: dm.channel.id,
1124
+
text,
1125
+
blocks: [
1126
+
{
1127
+
type: "section"asconst,
1128
+
text: {
1129
+
type: "mrkdwn"asconst,
1130
+
text,
1131
+
},
1132
+
},
1133
+
// For opted-out users, include a button to opt back in;
1134
+
// for skipping users, offer to skip the next round too
1135
+
...(!pref.isOptedIn
1136
+
? [
1137
+
{
1138
+
type: "actions"asconst,
1139
+
elements: [
1140
+
{
1141
+
type: "button"asconst,
1142
+
text: {
1143
+
type: "plain_text"asconst,
1144
+
text: "▶️ Resume Pairings",
1145
+
},
1146
+
style: "primary"asconst,
1147
+
action_id: "coffee_chat_opt_in",
1148
+
value: channelId,
1149
+
},
1150
+
],
1151
+
},
1152
+
]
1153
+
: isSkipping
1154
+
? [
1155
+
{
1156
+
type: "actions"asconst,
1157
+
elements: [
1158
+
{
1159
+
type: "button"asconst,
1160
+
text: {
1161
+
type: "plain_text"asconst,
1162
+
text: "⏭️ Skip Next Round Too",
1163
+
},
1164
+
action_id: "coffee_chat_skip_next",
1165
+
value: channelId,
1166
+
},
1167
+
{
1168
+
type: "button"asconst,
1169
+
text: {
1170
+
type: "plain_text"asconst,
1171
+
text: "🚫 Opt Out",
1172
+
},
1173
+
style: "danger"asconst,
1174
+
action_id: "coffee_chat_opt_out",
1175
+
value: channelId,
1176
+
},
1177
+
],
1178
+
},
1179
+
]
1180
+
: []),
1181
+
],
1182
+
});
1183
+
}catch(err){
1184
+
logWithTime(`Error notifying excluded user ${pref.userId}: ${err}`);
1185
+
}
1186
+
}),
1187
+
);
1188
+
};
1189
+
1076
1190
/**
1077
1191
* Clears the skip flag for users in a specific channel
0 commit comments