for channelMessage := range get_discord_channel_messages(Args{channel_id: trigger.channel_id, limit: 50}) {
send_text_message(Args{
channel_id: trigger.channel_id,
message_content: "Message ID: " + channelMessage.message_id,
})
}
Get Messages
Fetch recent messages from a channel and iterate over them.
- Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.
Inputs
ID of the channel to fetch messages from.
Number of messages to fetch (max 100).
Example: 50
Fetch messages before this message ID.
Fetch messages after this message ID.
Fetch messages around this message ID.
Blocks to run for each message.
Holds blocks
Outputs
Current iteration (1-based).
Example: 1
Total number of messages returned.
Example: 50
ID of the message.
Example: 123456789012345678
ID of the channel containing the message.
Example: 123456789012345678
ID of the server containing the message.
Example: 123456789012345678
Text content of the message.
ID of the message author.
Example: 123456789012345678
Username of the message author.
Display name of the message author.
Avatar URL of the message author.
Mention string for the message author.
Example: <@123456789012345678>
Whether the message author is a bot.
Example: false
Unix timestamp when the message was sent.
Example: 1640995200
Unix timestamp when the message was last edited. Empty if never edited.
Whether the message is pinned.
Example: false
Whether the message is text-to-speech.
Example: false
Whether the message mentions everyone.
Example: false
Comma-separated IDs of mentioned users.
Example: 123456789012345678,987654321098765432
Comma-separated IDs of mentioned roles.
Example: 123456789012345678,987654321098765432
Number of attachments on the message.
Example: 0
Comma-separated URLs of message attachments.
Number of embeds on the message.
Example: 0
ID of the message this is replying to. Empty if not a reply.
Webhook ID if the message was sent by a webhook.
Direct link to the message.
Example: https://discord.com/channels/123/456/789
ID of the thread started from this message. Empty if none.
Comma-separated IDs of stickers on the message.
Title of the first embed. For Components v2 messages, the leading "## " heading in the first container.
Description of the first embed. For Components v2 messages, the first plain text in the first container.
URL of the first embed.
Color of the first embed as a decimal integer. For Components v2 messages, the first container's accent color.
Example: 3447003
Image URL of the first embed. For Components v2 messages, the first gallery image in the first container.
Thumbnail URL of the first embed. For Components v2 messages, the first section thumbnail in the first container.
Footer text of the first embed. For Components v2 messages, the "-# " subtext in the first container.
Footer icon URL of the first embed.
Author name of the first embed.
Author URL of the first embed.
Author icon URL of the first embed.
Timestamp of the first embed.
Unix timestamp of the first embed.
Whether the message uses Components v2 (sent by Send Advanced Message or Send Embed Message blocks).
Example: false
All Components v2 text in the message, including text inside containers and sections, joined by newlines.
Accent color of the first Components v2 container as a decimal integer.
Example: 3447003
Comma-separated URLs of Components v2 gallery images and thumbnails.
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
get_discord_channel_messages- Loop block: write
for item := range get_discord_channel_messages(Args{...}) { ... }and read the current item's outputs fromitem. See loops.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Channel ID | channel_id | |
| Limit | limit | e.g. "50" |
| Before Message ID | before_id | |
| After Message ID | after_id | |
| Around Message ID | around_id | |
| Loop Body | body | blocks: func() { ... } |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Iteration Number | iteration_number | e.g. "1" |
| Total Iterations | total_iterations | e.g. "50" |
| Message ID | message_id | e.g. "123456789012345678" |
| Channel ID | channel_id | e.g. "123456789012345678" |
| Server ID | server_id | e.g. "123456789012345678" |
| Content | content | |
| Author ID | author_id | e.g. "123456789012345678" |
| Author Username | author_username | |
| Author Global Name | author_global_name | |
| Author Avatar URL | author_avatar_url | |
| Author Mention | author_mention | e.g. "<@123456789012345678>" |
| Author Is Bot | author_is_bot | e.g. "false" |
| Message Sent At (Unix) | message_sent_at | e.g. "1640995200" |
| Message Edited At (Unix) | message_edited_at | |
| Is Pinned | is_pinned | e.g. "false" |
| Is TTS | is_tts | e.g. "false" |
| Mention Everyone | mention_everyone | e.g. "false" |
| User Mentions | user_mentions | e.g. "123456789012345678,987654321098765432" |
| Role Mentions | role_mentions | e.g. "123456789012345678,987654321098765432" |
| Attachment Count | attachment_count | e.g. "0" |
| Attachment URLs | attachment_urls | |
| Embed Count | embed_count | e.g. "0" |
| Reply To Message ID | reply_to_message_id | |
| Webhook ID | webhook_id | |
| Message Link | message_link | e.g. "https://discord.com/channels/123/456/789" |
| Thread ID | thread_id | |
| Sticker IDs | sticker_ids | |
| Embed Title | embed_title | |
| Embed Description | embed_description | |
| Embed URL | embed_url | |
| Embed Color | embed_color | e.g. "3447003" |
| Embed Image URL | embed_image_url | |
| Embed Thumbnail URL | embed_thumbnail_url | |
| Embed Footer Text | embed_footer_text | |
| Embed Footer Icon URL | embed_footer_icon_url | |
| Embed Author Name | embed_author_name | |
| Embed Author URL | embed_author_url | |
| Embed Author Icon URL | embed_author_icon_url | |
| Embed Timestamp | embed_timestamp | |
| Embed Timestamp (Unix) | embed_timestamp_unix | |
| Is Components v2 | is_components_v2 | e.g. "false" |
| Text Content | text_content | |
| Container Accent Color | container_accent_color | e.g. "3447003" |
| Media URLs | media_urls |