DiscordReader
DiscordReader is a simple data loader that reads all messages in a given Discord channel and returns them as Document objects. It uses the @discordjs/rest library to fetch the messages.
Installation
Section titled “Installation”npm install @llamaindex/discordFirst step is to create a Discord Application and generating a bot token here.
In your Discord Application, go to the OAuth2 tab and generate an invite URL by selecting bot and click Read Messages/View Channels as wells as Read Message History.
This will invite the bot with the necessary permissions to read messages.
Copy the URL in your browser and select the server you want your bot to join.
Params
Section titled “Params”DiscordReader()
Section titled “DiscordReader()”discordToken?: The Discord bot token.requestHandler?: Optionally provide a custom request function for edge environments, e.g.fetch. See discord.js for more info.
DiscordReader.loadData
Section titled “DiscordReader.loadData”channelIDs: The ID(s) of discord channels as an array of strings.limit?: Optionally limit the number of messages to readadditionalInfo?: An optional flag to include embedded messages and attachment urls in the document.oldestFirst?: An optional flag to return the oldest messages first.
API Reference
Section titled “API Reference”Note for AI agents: this documentation is built for programmatic access.
- Overview of all docs: https://developers.llamaindex.ai/llms.txt
- Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md
- Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters.
- A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/for-agents/mcp/
- Other LlamaIndex tooling for agents — the LlamaParse Platform MCP server, agent skills and plugins, and the n8n node — is mapped at https://developers.llamaindex.ai/for-agents/