Skip to content

Commit

Permalink
Thread decision fixes
Browse files Browse the repository at this point in the history
### Notes
This resolves a few issues with the thread decisions:
- Let's make sure when an interaction is pressed. the text output corresponds to that action (i.e status update)
- We edit the original interaction to remove the buttons when clicked as well as marked with the action taken, and by who.
  • Loading branch information
zuuring committed Dec 3, 2024
1 parent 640b502 commit 819d09a
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions discord-scripts/thread-management/check-thread-archiving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,19 @@ const threadActions: {
emoji: "☑️",
extendAutoArchive: false,
handler: async (thread, interaction) => {
const user = interaction.user

Check failure on line 102 in discord-scripts/thread-management/check-thread-archiving.ts

View workflow job for this annotation

GitHub Actions / lint

Use object destructuring
await interaction.reply({
content: "Sounds like this thread is ready to archive, doing that now!",
ephemeral: true,
})
await thread.setArchived(true)

await interaction.message.edit({
content: `${interaction.message.content}\n\n☑️ **Archived** by ${userMention(

Check failure on line 110 in discord-scripts/thread-management/check-thread-archiving.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `interaction.message.content}\n\n☑️·**Archived**·by·${userMention(⏎··········user.id,⏎········` with `⏎··········interaction.message.content⏎········}\n\n☑️·**Archived**·by·${userMention(user.id`
user.id,
)}`,
components: [],
})
thread.setArchived(true)
},
},
"check-thread-archiving-task-button": {
Expand Down Expand Up @@ -147,6 +156,13 @@ const threadActions: {
"capture the task(s) associated with",
userIdToTag,
)

await interaction.message.edit({
content: `${interaction.message.content}\n\n🔲 **Task capture requested** by ${userMention(

Check failure on line 161 in discord-scripts/thread-management/check-thread-archiving.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `interaction.message.content` with `⏎··········interaction.message.content⏎········`
interaction.user.id,
)}`,
components: [],
})
},
},
"check-thread-archiving-status-button": {
Expand Down Expand Up @@ -189,9 +205,16 @@ const threadActions: {
thread,
interaction,
interaction.member,
"capture the task(s) associated with",
"post a status associated with",
userIdToTag,
)

await interaction.message.edit({
content: `${interaction.message.content}\n\n✍️ **Status requested** by ${userMention(

Check failure on line 213 in discord-scripts/thread-management/check-thread-archiving.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `interaction.message.content}\n\n✍️·**Status·requested**·by·${userMention(⏎··········interaction.user.id,⏎········` with `⏎··········interaction.message.content⏎········}\n\n✍️·**Status·requested**·by·${userMention(interaction.user.id`
interaction.user.id,
)}`,
components: [],
})
},
},
"check-thread-archiving-pending-decision-button": {
Expand Down Expand Up @@ -234,9 +257,16 @@ const threadActions: {
thread,
interaction,
interaction.member,
"capture the task(s) associated with",
"make a decision for",
userIdToTag,
)

await interaction.message.edit({
content: `${interaction.message.content}\n\n🫵 **Decision requested** by ${userMention(

Check failure on line 265 in discord-scripts/thread-management/check-thread-archiving.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `interaction.message.content}\n\n🫵·**Decision·requested**·by·${userMention(⏎··········interaction.user.id,⏎········` with `⏎··········interaction.message.content⏎········}\n\n🫵·**Decision·requested**·by·${userMention(interaction.user.id`
interaction.user.id,
)}`,
components: [],
})
},
},
}
Expand Down

0 comments on commit 819d09a

Please sign in to comment.