K
Docs
API Reference→Pieces→Grab Images from a Message
📎

Grab Images from a Message

img.from_messageThe DarkroomImages

Collects the images on a message — uploads, embed images and stickers. Use the message that triggered the flow, the one that was right-clicked, the one it replies to, or any message link. You get the first (or last) image plus a list of all of them.

When to use this
  • →On a Full Bot, a New Message trigger + this piece reacts to every image people post
  • →{{imageList}} has every image — feed it straight into a Flipbook

On the canvas

This is what Grab Images from a Message looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

📎
Grab Images from a Message
img.from_message
Images
from
select…
link
https://discord.com/channels/… (only for “A message link”)
which
select…
as
image
found
empty

Config fields

FieldTypeReqWhat it does
fromselect—Which message 💬
link
https://discord.com/channels/… (only for “A message link”)
text—Message link 🔗
whichselect—Which image 🖼️
as
image
text—Save it as ✨

Output ports

foundAt least one image came back
emptyThe message has no pictures (or couldn't be found)
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
// Attachments, embed images and stickers — in that order
const urls = [
  ...message.attachments.filter((a) => a.contentType?.startsWith("image/")).map((a) => a.url),
  ...message.embeds.map((e) => e.image?.url ?? e.thumbnail?.url).filter(Boolean),
  ...message.stickers.map((s) => s.url),
];
const first = urls[0] ? await loadImage(urls[0]) : null;