This is a modern C# Discord bot powered by DSharpPlus and orchestrated with n8n for flexible, extendable (AI) workflows.
Responses are generated by an AI agent via n8n, and you have one simple /aiagent command that gives you the full power of connected tools - language, image, or automation, depending on your n8n flow.
If you prefer a plug-and-play solution without n8n, a standalone hosted version of the bot is also available at https://github.com/omgitsjan/DiscordBotAiStarter.
- AI chat command (
/aiagent
) - connect to your own n8n workflows, leveraging OpenAI and any other n8n tools in one command - Ping command (
/ping
) - check bot latency and uptime - Easily extensible for custom flows or plugins
- Full Docker and local development support
- A Discord bot token
- An n8n workflow URL (Webhook) and API key
- .NET 8+ SDK
- Docker (optional, for containerized runs)
-
Clone and build:
git clone https://github.com/omgitsjan/DiscordBotN8n.git
cd DiscordBotN8n
dotnet restore
dotnet build
-
Copy
appsettings.Template.json
toappsettings.json
. -
Edit
appsettings.json
and fill in your credentials:
Code:
{
"DiscordBot":{
"Token":"<Your Discord Bot Token>"
},
"n8n":{
"ApiKey":"<Your n8n API Key>",
"AiAgentWorkflowUrl":"<Your n8n Webhook URL>"
}
}
- Run the bot:
dotnet run
An official image is published on Docker Hub:
docker pull omgitsjan/discordbotn8n docker run -v /path/to/appsettings.json:/app/appsettings.json omgitsjan/discordbotn8n
Or use the provided docker-compose.yml
for local development:
docker-compose up --build
**/aiagent <message>**
Send any prompt to your n8n-powered AI agent.
Example:
/aiagent What tools do you have?
/ping
Check bot latency and uptime.
Example:
/ping
If you don’t want to run your own n8n instance, you can try the bot directly as a hosted, plug-and-play version at https://github.com/omgitsjan/DiscordBotAiStarter.
Contributions, issues, and pull requests are welcome!
Run tests with:
dotnet test
This project is licensed under the MIT License.
See LICENSE for details.