for searchGuildMessage := range search_discord_guild_messages(Args{server_id: trigger.server_id, search_content: "hello world"}) {
send_text_message(Args{
channel_id: trigger.channel_id,
message_content: "Total Results: " + searchGuildMessage.total_results,
})
}
Search Server Messages
Search a server's messages and iterate over the matched messages.
- Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.
Inputs
ID of the server to search in.
Text to search for in message content.
Example: hello world
Optional comma-separated channel IDs to restrict the search to.
Optional comma-separated author user IDs to restrict the search to.
Optional comma-separated user IDs that must be mentioned.
Optional comma-separated has filters, such as attachment, sound, or poll.
Only include messages newer than this message ID.
Only include messages older than this message ID.
Filter by whether matched messages mention @everyone or @here.
How the search results should be sorted.
Whether results should be sorted ascending or descending.
Pagination offset to start from (0-5000).
Example: 0
Maximum matched messages to return (1-25, default 25).
Example: 25
Blocks to run for each matched message.
Holds blocks
Outputs
Current iteration (1-based).
Example: 1
Total matched messages returned in this page.
Example: 25
Total number of matched messages reported by Discord.
Example: 240
Opaque analytics identifier returned by Discord for this search.
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
search_discord_guild_messages- Loop block: write
for item := range search_discord_guild_messages(Args{...}) { ... }and read the current item's outputs fromitem. See loops.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Server ID | server_id | |
| Search Content | search_content | e.g. "hello world" |
| Channel IDs | channel_ids | |
| Author IDs | author_ids | |
| Mention IDs | mention_ids | |
| Has Filters | has_filters | |
| Minimum Message ID | min_message_id | |
| Maximum Message ID | max_message_id | |
| Mention Everyone | mention_everyone | "Any", "true", "false" |
| Sort By | sort_by | "relevance", "timestamp" |
| Sort Order | sort_order | "desc", "asc" |
| Offset | offset | e.g. "0" |
| Limit | limit | e.g. "25" |
| Loop Body | body | blocks: func() { ... } |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Iteration Number | iteration_number | e.g. "1" |
| Total Iterations | total_iterations | e.g. "25" |
| Total Results | total_results | e.g. "240" |
| Analytics ID | analytics_id | |
| 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 |