Overview
Integration details
Class | Package | Serializable | JS support | Version |
---|---|---|---|---|
DiscordReadMessages , DiscordSendMessage | langchain-discord-shikenso | N/A | TBD |
Tool features
DiscordReadMessages
: Reads messages from a specified channel.DiscordSendMessage
: Sends messages to a specified channel.
Setup
The integration is provided by thelangchain-discord-shikenso
package. Install it as follows:
Credentials
This integration requires you to setDISCORD_BOT_TOKEN
as an environment variable to authenticate with the Discord API.
Instantiation
Below is an example showing how to instantiate the Discord tools inlangchain_discord
. Adjust as needed for your specific usage.
Invocation
Direct invocation with args
Below is a simple example of calling the tool with keyword arguments in a dictionary.Invocation with ToolCall
If you have a model-generatedToolCall
, pass it to tool.invoke()
in the format shown below.
Chaining
Below is a more complete example showing how you might integrate theDiscordReadMessages
and DiscordSendMessage
tools in a chain or agent with an LLM. This example assumes you have a function (like create_agent
) that sets up a LangChain-style agent capable of calling tools when appropriate.