Discord Tools icon

Discord Tools

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

Overview

This node provides a utility to export all messages from a specified Discord channel within a guild (server). It fetches up to 100 messages from the channel and returns detailed information about each message, including the message ID, content, author details, creation timestamp, and any attachments. This is useful for backing up channel conversations or exporting message data for analysis or archival purposes.

Use Case Examples

  1. Export all messages from a specific channel in a Discord server to create a backup of the conversation history.
  2. Retrieve messages from a channel to analyze user interactions or content shared within that channel.

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 export messages.
Additional Options Optional parameters to customize message fetching, such as including bot messages, filtering messages before or after a specific message ID, case sensitivity, exact text matching, audit log filtering, and audit log entry limits.

Output

JSON

  • channelId - The ID of the channel from which messages were exported.
  • guildId - The ID of the guild (server) containing the channel.
  • exportedAt - The ISO timestamp when the export was performed.
  • totalMessages - The total number of messages exported from the channel.
  • messages
    • id - The unique ID of the message.
    • content - The text content of the message.
    • author
      * id - The ID of the user who authored the message.
      * username - The username of the message author.
    • createdTimestamp - The timestamp when the message was created.
    • createdAt - The ISO string representation of the message creation time.
    • attachments - An array of attachments included in the message, each with its ID, URL, and name.

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 a text-based channel; voice or category channels are not supported for message export.
  • If no messages are returned, check if the channel contains messages or if filters exclude all messages.
  • Common error messages include 'Channel not found' if the channel ID is invalid or inaccessible, and 'Invalid channel type' if the channel is not text-based. Resolving these involves verifying IDs and bot permissions.

Links

Discussion