Skip to content

A modern C# Discord bot built with DSharpPlus and powered by n8n for flexible (AI) workflows. One simple /aiagent command unlocks AI responses, image generation, and automation through your custom n8n flows—seamlessly connected and fully extendable.

License

Notifications You must be signed in to change notification settings

omgitsjan/DiscordBotN8n

DiscordBotN8n - Starter C# Discord Bot powerd by n8n

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.

Features

  • 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

Installation

Prerequisites

  • A Discord bot token
  • An n8n workflow URL (Webhook) and API key
  • .NET 8+ SDK
  • Docker (optional, for containerized runs)

Quickstart

  1. Clone and build: git clone https://github.com/omgitsjan/DiscordBotN8n.git cd DiscordBotN8n dotnet restore dotnet build

  2. Copy appsettings.Template.json to appsettings.json.

  3. 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>"
   }
}
  1. Run the bot: dotnet run

Docker

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

Usage

**/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

Standalone Hosted Bot

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.

Contributing

Contributions, issues, and pull requests are welcome!
Run tests with:

dotnet test

License

This project is licensed under the MIT License.
See LICENSE for details.

About

A modern C# Discord bot built with DSharpPlus and powered by n8n for flexible (AI) workflows. One simple /aiagent command unlocks AI responses, image generation, and automation through your custom n8n flows—seamlessly connected and fully extendable.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •