langchain-discord
This package provides Discord tools and a toolkit for use with LangChain. It includes:
DiscordReadMessages: Read messages from a given Discord channel.DiscordSendMessage: Send messages to a given Discord channel.DiscordToolkit: A convenient toolkit that bundles these tools.
Installation
pip install -U langchain-discord
Environment Variable
Export your bot token so the tools can authenticate with the Discord API:
export DISCORD_BOT_TOKEN="your-discord-bot-token"
If this environment variable is not set, the tools will raise a ValueError when instantiated.
Usage
Direct Tool Usage
from langchain_discord.tools.discord_read_messages import DiscordReadMessages
from langchain_discord.tools.discord_send_messages import DiscordSendMessage
# Create instances of each tool
read_tool = DiscordReadMessages()
send_tool = DiscordSendMessage()
# Read the last 5 messages from channel 1234567890
read_result = read_tool({"channel_id": "1234567890", "limit": 5})
print(read_result)
# Send a message to the same channel
send_result = send_tool({"channel_id": "1234567890", "message": "Hello from Python!"})
print(send_result)
Using the Toolkit
You can also use DiscordToolkit to automatically gather both tools:
from langchain_discord.toolkits import DiscordToolkit
toolkit = DiscordToolkit()
tools = toolkit.get_tools()
# tools[0] should be DiscordReadMessages, tools[1] is DiscordSendMessage
read_tool = tools[0]
send_tool = tools[1]
# Example usage
print(read_tool({"channel_id": "1234567890", "limit": 5}))
print(send_tool({"channel_id": "1234567890", "message": "Hello from toolkit!"}))
Tests
If you have a tests folder (e.g. tests/unit_tests/), you can run them (assuming Pytest) with:
pytest --maxfail=1 --disable-warnings -q
Make sure your DISCORD_BOT_TOKEN is set or your tests are mocked so they don’t require a real token.
License
Further Documentation
-
For more details, see the docstrings in:
discord_read_messages.pydiscord_send_messages.pytoolkits.pyforDiscordToolkit
-
Official Discord Developer Docs: https://discord.com/developers/docs/intro
-
LangChain GitHub for general LangChain usage and tooling.
Metadata
Release files for langchain-discord-shikenso 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_discord_shikenso-1.1.1.tar.gz | 5.7 kB | Without provenance | Details for langchain_discord_shikenso-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_discord_shikenso-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for langchain_discord_shikenso-1.1.1-py3-none-any.whl |
Total release size: 14.6 kB
Release files / langchain_discord_shikenso-1.1.1.tar.gz
| Download URL | langchain_discord_shikenso-1.1.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72182dc0aef4804210f2375f3e63d7deca05c978db5be597a704f9fe40ea399e
|
|
BLAKE2b-256 checksum How to use checksums |
9866cc9a773b60cebc409eca1009f69320930f143d48b41512ef7e225314a7af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.13.2 Linux/6.8.0-52-generic
|
Release files / langchain_discord_shikenso-1.1.1-py3-none-any.whl
| Download URL | langchain_discord_shikenso-1.1.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f200e09adda20f81ede08f9b38a809c845ff4a344b6f7ec269ab4912fbf07e4
|
|
BLAKE2b-256 checksum How to use checksums |
d32e1115b5e921657e50fa67085911f0d227d5772eddec182bab2199db8fd7b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.13.2 Linux/6.8.0-52-generic
|
Security for langchain-discord-shikenso 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.