Skip to content

Commit 60b9152

Browse files
Changing messages when creating pairings
1 parent 7e05976 commit 60b9152

3 files changed

Lines changed: 112 additions & 55 deletions

File tree

src/coffeeChats/controllers.ts

Lines changed: 109 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,56 @@ import {
99
} from "./models";
1010

1111
const COFFEE_CHAT_ACTIVITIES = [
12-
"grab coffee at a local café",
13-
"get lunch together",
14-
"take a walk around campus",
15-
"play a board game",
16-
"work together at a coffee shop",
17-
"grab bubble tea",
18-
"check out a new restaurant",
19-
"visit a local museum or gallery",
20-
"play video games together",
21-
"go for a quick hike",
22-
"grab ice cream",
23-
"cook a meal together",
24-
"attend a campus event",
25-
"play pool or ping pong",
26-
"do a workout or go to the gym together",
27-
"visit a bookstore",
28-
"try a new food spot",
29-
"have a video call chat",
30-
"collaborate on a side project",
31-
"attend a workshop or talk together",
32-
"get breakfast or brunch",
33-
"go rock climbing",
34-
"visit a farmers market",
35-
"play mini golf",
36-
"watch a movie together",
37-
"go bowling",
38-
"visit a cat café",
39-
"try an escape room",
40-
"go to a comedy show",
41-
"take a photography walk",
42-
"visit an arcade",
43-
"go thrifting or vintage shopping",
44-
"attend a concert or live music event",
45-
"play frisbee or catch",
46-
"visit a botanical garden",
47-
"go stargazing",
48-
"try a painting or pottery class",
49-
"explore a new neighborhood",
50-
"visit a library or study lounge",
51-
"go for a bike ride",
52-
"try a new coffee brewing method together",
53-
"attend a trivia night",
54-
"visit a local bakery",
55-
"play cards or a deck game",
56-
"go to a sports game",
57-
"try a cooking class",
58-
"visit a rooftop or scenic viewpoint",
59-
"go kayaking or paddle boarding",
60-
"attend a meditation or yoga session",
61-
"explore local street art or murals",
12+
"Grab coffee at a local café",
13+
"Get lunch together 🍽️",
14+
"Take a walk around campus 🚶",
15+
"Play a board game 🎲",
16+
"Work together at a coffee shop 💻",
17+
"Grab bubble tea 🧋",
18+
"Check out a new restaurant 🍴",
19+
"Visit a local museum or gallery 🖼️",
20+
"Play video games together 🎮",
21+
"Go for a quick hike 🥾",
22+
"Grab ice cream 🍦",
23+
"Cook a meal together 👨‍🍳",
24+
"Attend a campus event 🎪",
25+
"Play pool or ping pong 🎱",
26+
"Do a workout or go to the gym together 💪",
27+
"Visit a bookstore 📚",
28+
"Try a new food spot 🍕",
29+
"Have a video call chat 📹",
30+
"Collaborate on a side project 🛠️",
31+
"Attend a workshop or talk together 🎤",
32+
"Get breakfast or brunch 🥞",
33+
"Go rock climbing 🧗",
34+
"Visit a farmers market 🥕",
35+
"Play mini golf",
36+
"Watch a movie together 🎬",
37+
"Go bowling 🎳",
38+
"Visit a cat café 🐱",
39+
"Try an escape room 🔐",
40+
"Go to a comedy show 😂",
41+
"Take a photography walk 📸",
42+
"Visit an arcade 🕹️",
43+
"Go thrifting or vintage shopping 👗",
44+
"Attend a concert or live music event 🎵",
45+
"Play frisbee or catch 🥏",
46+
"Visit a botanical garden 🌺",
47+
"Go stargazing 🌟",
48+
"Try a painting or pottery class 🎨",
49+
"Explore a new neighborhood 🗺️",
50+
"Visit a library or study lounge 📖",
51+
"Go for a bike ride 🚴",
52+
"Try a new coffee brewing method together",
53+
"Attend a trivia night 🧠",
54+
"Visit a local bakery 🥐",
55+
"Play cards or a deck game 🃏",
56+
"Go to a sports game 🏀",
57+
"Try a cooking class 🍳",
58+
"Visit a rooftop or scenic viewpoint 🌆",
59+
"Go kayaking or paddle boarding 🛶",
60+
"Attend a meditation or yoga session 🧘",
61+
"Explore local street art or murals 🎨",
6262
];
6363

6464
/**
@@ -210,6 +210,9 @@ const notifyPairing = async (
210210
return null;
211211
}
212212

213+
// Calculate deadline (2 weeks from now)
214+
const deadline = moment().tz("America/New_York").add(2, "weeks");
215+
213216
// Send a message to the group DM with interactive buttons
214217
const messageResult = await slackbot.client.chat.postMessage({
215218
channel: conversation.channel.id!,
@@ -219,21 +222,28 @@ const notifyPairing = async (
219222
type: "section",
220223
text: {
221224
type: "mrkdwn",
222-
text: `Hey ${userMentions}! You've been paired for a coffee chat. ☕`,
225+
text: `:tada: Hey ${userMentions}! You've been paired for a coffee chat. ☕`,
226+
},
227+
},
228+
{
229+
type: "section",
230+
text: {
231+
type: "mrkdwn",
232+
text: `:bulb: *Suggested activity:* ${activity}\n\nTake some time over the next two weeks to connect and get to know each other better!`,
223233
},
224234
},
225235
{
226236
type: "section",
227237
text: {
228238
type: "mrkdwn",
229-
text: `*Suggested activity:* ${activity}\n\nTake some time in the next two weeks to connect and get to know each other better!`,
239+
text: `:calendar: *Meet by:* ${deadline.format("dddd, MMMM Do")}`,
230240
},
231241
},
232242
{
233243
type: "section",
234244
text: {
235245
type: "mrkdwn",
236-
text: `📸 *Don't forget to snap some photos!* Share them here in this chat — we'll post a collection in the channel after two weeks to celebrate your meetup!`,
246+
text: `:camera_with_flash: *Don't forget to snap some photos!* Share them here in this chat — we'll post a collection in the channel after two weeks to celebrate your meetup!`,
237247
},
238248
},
239249
{
@@ -279,6 +289,18 @@ export const processCoffeeChatChannel = async (
279289
try {
280290
logWithTime(`Processing coffee chats for channel ${config.channelName}`);
281291

292+
// Expire all previous active pairings for this channel
293+
const expireResult = await CoffeeChatPairingModel.updateMany(
294+
{ channelId: config.channelId, isActive: true },
295+
{ isActive: false },
296+
);
297+
298+
if (expireResult.modifiedCount > 0) {
299+
logWithTime(
300+
`Expired ${expireResult.modifiedCount} previous pairing(s) for ${config.channelName}`,
301+
);
302+
}
303+
282304
// Get all channel members
283305
const members = await getChannelMembers(config.channelId);
284306

@@ -313,6 +335,7 @@ export const processCoffeeChatChannel = async (
313335
createdAt: now,
314336
notifiedAt: now,
315337
conversationId: conversationId || undefined,
338+
isActive: true,
316339
reminderSent: false,
317340
photosPosted: false,
318341
});
@@ -326,6 +349,39 @@ export const processCoffeeChatChannel = async (
326349
{ lastPairingDate: now },
327350
);
328351

352+
// Send announcement to the channel
353+
const nextPairingDate = moment()
354+
.tz("America/New_York")
355+
.add(2, "weeks");
356+
357+
await slackbot.client.chat.postMessage({
358+
channel: config.channelId,
359+
text: "Coffee chat pairings have been created!",
360+
blocks: [
361+
{
362+
type: "section",
363+
text: {
364+
type: "mrkdwn",
365+
text: `:tada: Hooray! I just created ${pairings.length} coffee chat pairing${pairings.length !== 1 ? "s" : ""} a few moments ago.`,
366+
},
367+
},
368+
{
369+
type: "section",
370+
text: {
371+
type: "mrkdwn",
372+
text: `:coffee: Have fun meeting with your coffee chat partner${pairings.length > 1 ? "s" : ""} :slightly_smiling_face:`,
373+
},
374+
},
375+
{
376+
type: "section",
377+
text: {
378+
type: "mrkdwn",
379+
text: `:calendar: Your next scheduled pairing is on ${nextPairingDate.format("dddd (MMM Do)")} at ${nextPairingDate.format("h:mm A z")}`,
380+
},
381+
},
382+
],
383+
});
384+
329385
logWithTime(`✅ Completed coffee chat pairings for ${config.channelName}`);
330386
} catch (error) {
331387
logWithTime(

src/coffeeChats/models.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class CoffeeChatPairing {
1616
@prop()
1717
conversationId?: string;
1818

19+
@prop({ default: true })
20+
isActive!: boolean;
21+
1922
@prop({ default: false })
2023
reminderSent!: boolean;
2124

src/slackbot.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ slackbot.command("/trigger-coffee-chats", async ({ command, ack, say }) => {
133133
return;
134134
}
135135

136-
await say(`☕ Generating coffee chat pairings...`);
137136
await processCoffeeChatChannel(config);
138-
await say(`✅ Coffee chat pairings have been sent via DM!`);
139137
} catch (error) {
140138
await say(`❌ Error triggering coffee chats: ${error}`);
141139
}

0 commit comments

Comments
 (0)