Actions30
- Message Actions
- User Actions
- Channel Actions
- Guild Actions
- Emoji Actions
- Analytics Actions
- Moderation Actions
- Backup Actions
- DM Actions
Overview
This node operation fetches multiple messages from a specified Discord channel within a guild (server). It allows users to retrieve messages with various filters such as limiting the number of messages, including or excluding bot messages, and fetching messages before or after a specific message ID. This is useful for scenarios like analyzing recent conversations, archiving messages, or monitoring channel activity.
Use Case Examples
- Fetch the last 50 messages from a specific channel in a Discord server.
- Retrieve messages sent before a certain message ID to analyze past discussions.
- Include bot messages in the fetched results for comprehensive channel monitoring.
Properties
| Name | Meaning |
|---|---|
| Guild ID | The ID of the Discord server (guild) where the channel is located. |
| Channel ID | The ID of the channel from which to fetch messages. |
| Limit | The maximum number of messages to fetch, up to 100. |
| Additional Options | Optional filters and settings for fetching messages, including whether to include bot messages, message ID boundaries (before/after), and other search-related options. |
Output
JSON
id- The unique identifier of the message.content- The text content of the message.authorid- The unique identifier of the message author.username- The username of the message author.bot- Indicates if the author is a bot.
channelId- The ID of the channel where the message was sent.guildId- The ID of the guild (server) where the message was sent.createdTimestamp- Timestamp when the message was created.attachments- ``
*id- ID of each attachment in the message.
*url- URL of each attachment.
*name- Name of each attachment.
- ``
embeds- `` - Array of embed objects included in the message.
reactions- ``
*emoji- Name of the emoji used in reactions.
*count- Count of each reaction emoji.
- ``
Dependencies
- Discord API
- discord.js library
- An API key credential for Discord bot authentication
Troubleshooting
- Ensure the Guild ID and Channel ID are correct and the bot has access to the specified channel.
- Verify the channel is text-based; voice or category channels are not supported for message fetching.
- Limit the number of messages fetched to 100 or fewer to avoid API restrictions.
- Check for proper permissions of the bot to read message history in the channel.
- Common error: 'Channel not found' indicates invalid or inaccessible channel ID.
- Common error: 'Invalid channel type' indicates the channel is not text-based.
Links
- Discord API - Get Channel Messages - Official Discord API documentation for fetching messages from a channel.