Skip to content

Commit

Permalink
feat: prefill edit title modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Smart committed Apr 26, 2023
1 parent d57f451 commit 4d7ae55
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/AutoThreads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,25 @@ const make = Effect.gen(function* ($) {
const edit = Ix.messageComponent(
Ix.idStartsWith("edit_"),
checkPermissions(() =>
Effect.succeed(
Ix.r({
type: Discord.InteractionCallbackType.MODAL,
data: {
custom_id: "edit",
title: "Edit title",
components: UI.singleColumn([
UI.textInput({ custom_id: "title", label: "New title" }),
]),
},
}),
pipe(
Ix.Interaction,
Effect.flatMap(ix => channels.get(ix.guild_id!, ix.channel_id!)),
Effect.map(channel =>
Ix.r({
type: Discord.InteractionCallbackType.MODAL,
data: {
custom_id: "edit",
title: "Edit title",
components: UI.singleColumn([
UI.textInput({
custom_id: "title",
label: "New title",
value: channel.name!,
}),
]),
},
}),
),
),
),
)
Expand Down

0 comments on commit 4d7ae55

Please sign in to comment.