Discord Tools icon

Discord Tools

Discord utility tools - Message fetching, user info, and more

Overview

This node operation fetches the message history from a specified Discord channel within a guild (server). It allows users to retrieve a list of messages with various filtering options such as limiting the number of messages, including or excluding bot messages, and filtering messages before or after a specific message ID. This is useful for scenarios like auditing conversations, analyzing chat activity, or backing up message data from a Discord channel.

Use Case Examples

  1. Fetch the last 50 messages from a specific channel excluding bot messages.
  2. Retrieve messages posted after a certain message ID to monitor recent activity.
  3. Get a filtered list of messages including bot messages for moderation purposes.

Properties

Name Meaning
Guild ID The ID of the Discord server (guild) where the channel is located.
Channel ID The ID of the text-based channel from which to fetch message history.
Limit The maximum number of messages to fetch, with a cap at 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.
  • author
    • id - The unique identifier of the message author.
    • username - The username of the message author.
    • displayName - The display name of the message author (if available).
    • bot - Boolean indicating if the author is a bot.
  • channelId - The ID of the channel where the message was posted.
  • createdTimestamp - Timestamp when the message was created.
  • editedTimestamp - Timestamp when the message was last edited (if applicable).
  • pinned - Boolean indicating if the message is pinned in the channel.
  • mentionEveryone - Boolean indicating if the message mentions everyone.
  • attachments
    • ``
      * id - ID of each attachment in the message.
      * url - URL of each attachment.
      * name - Name of each attachment.
      * size - Size of each attachment in bytes.

Dependencies

  • Discord API
  • discord.js library
  • An API key credential for Discord bot authentication

Troubleshooting

  • Ensure the provided Guild ID and Channel ID are correct and that the bot has access to the specified channel.
  • Verify that the channel is text-based; voice or category channels are not supported for message history fetching.
  • If no messages are returned, check the filter options such as 'before' and 'after' message IDs to ensure they are valid and within the message range.
  • Common error: 'Channel not found' indicates either incorrect IDs or insufficient bot permissions.
  • Common error: 'Invalid channel type' means the selected channel is not suitable for message operations.

Links

Discussion