Skip to content

Commit

Permalink
Fix message templates
Browse files Browse the repository at this point in the history
  • Loading branch information
imxeno committed May 20, 2024
1 parent 8f73c1e commit 558d20b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions apps/bot/src/modules/boards/listeners/thread-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ export class BoardsThreadCreateListener extends Listener<"threadCreate"> {
(tag) => tag.id === status.tagId.toString()
)?.name;

const lastMessage = await thread.lastMessage?.fetch();

await thread.send({
content: (
config.threadCreatedMessage ?? "Thread created with status {name}."
).replaceAll("{name}", tagName || ""),
config.threadCreatedMessage ?? "Thread created with status {tagName}."
)
.replaceAll("{userId}", lastMessage?.author.id || "")
.replaceAll("{tagName}", tagName || ""),
});
}
}
12 changes: 6 additions & 6 deletions apps/bot/src/modules/boards/listeners/thread-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export class BoardsThreadUpdateListener extends Listener<"threadUpdate"> {
);
await newThread.send({
content: (
config.threadStatusChangedMessage ?? "Status changed to {name}."
).replaceAll("{name}", status.name || ""),
config.threadStatusChangedMessage ?? "Status changed to {tagName}."
).replaceAll("{tagName}", status.name || ""),
});
}
return;
Expand Down Expand Up @@ -107,8 +107,8 @@ export class BoardsThreadUpdateListener extends Listener<"threadUpdate"> {
);
await newThread.send({
content: (
config.threadStatusChangedMessage ?? "Status changed to {name}."
).replaceAll("{name}", status.name || ""),
config.threadStatusChangedMessage ?? "Status changed to {tagName}."
).replaceAll("{tagName}", status.name || ""),
});
}
return;
Expand All @@ -129,8 +129,8 @@ export class BoardsThreadUpdateListener extends Listener<"threadUpdate"> {
);
await newThread.send({
content: (
config.threadStatusChangedMessage ?? "Status changed to {name}."
).replaceAll("{name}", status.name || ""),
config.threadStatusChangedMessage ?? "Status changed to {tagName}."
).replaceAll("{tagName}", status.name || ""),
});

// Lock/unlock thread based on status tag
Expand Down

0 comments on commit 558d20b

Please sign in to comment.