A Discord bot written in Rust using the poise framework (built on top of serenity). This bot connects to your Linkding instance via its API, allowing Discord users to manage and share useful links with friends directly from Discord.
[!WARNING] Early development Core features like adding, posting, and retrieving links by ID are functional, but many important features, including access controls, are not yet implemented.
- Add new links to your Linkding instance from Discord
- Post new and existing links in Discord channels
- Retrieve links by ID
- Check the reachability of your Linkding instance
- More features planned!
- Access to a running Linkding instance and its API token,
- A Discord bot token,
- For source builds, the Rust toolchain (latest stable).
Create a .env file as described under Configuration, then run the latest stable image:
docker run --detach \
--name linkding-discord-bot \
--restart unless-stopped \
--env-file .env \
ghcr.io/mcb2003/linkding-discord-bot:latestCreate a compose.yaml alongside your .env file:
services:
bot:
image: ghcr.io/mcb2003/linkding-discord-bot:latest
restart: unless-stopped
env_file: .envStart the bot in the background:
docker compose up --detachClone the repository
git clone https://github.com/mcb2003/linkding-discord-bot
cd linkding-discord-botCompile the project:
cargo build --releaseRun it:
cargo run --releaseOr:
bash
./target/release/linkding-discord-bot
### Configuration
The bot is configured with environment variables, either collected from the process environment or read from a `.env` file.
Environment Variable | Purpose
--- | ---
`DISCORD_TOKEN` | Bot token from your Discord application's **Bot** page (get one in the [Developer Portal](https://discord.com/developers/applications)).
`LINKDING_BASE_URL` | Base URL of your Linkding instance, e.g. `https://linkding.example.com`.
`LINKDING_API_TOKEN` | API token used to authenticate requests to your Linkding instance.
## Usage
Once running, invite the bot to your server using a link like this, replacing "XXXXXXXX" with your Discord application's client ID:
https://discord.com/oauth2/authorize?client_id=XXXXXXXX&permissions=274878154816&integration_type=0&scope=bot+applications.commands
Then use the available commands:
- `/link add <url>` — Add a new link to Linkding
- `/link get <id>` — Retrieve a link by its ID
- `/link post <url> <message>` — Post a link to the current channel
> If you find you can't run any slash commands, you may need to register them in your server. To do so, mention your bot user in a new message with the content "register", then follow the instructions.
More commands and documentation coming soon!
## Roadmap
- More advanced link management features,
- Searching existing links,
- Per server Linkding instances,
- optional per user API tokens,
- Improved error handling and feedback,
- Access controls,
- Automatic tags based on server / channel,
- More ...
## Contributing
Contributions are welcome! Please open [issues](https://github.com/mcb2003/linkding-discord-bot/issues) or [pull requests](https://github.com/mcb2003/linkding-discord-bot/fork).
## License
This project is licensed under the [MIT License](./LICENSE).
---
*This project is not affiliated with Linkding or Discord.*