A lightweight and fast AI-powered Discord chatbot built using Golang, DiscordGo, and the OpenAI API.
This bot listens to Discord commands and responds with:
- Latency checks
- Greetings
- AI-generated answers using the
!askcommand
Ask the bot anything using:
!ask What is Golang?
The bot sends your question to OpenAI and replies with an intelligent answer.
!ping β Pong!
!hello β Simple greeting
Fast, concurrent, simple to deploy, and easy to extend.
- Go (Golang)
- DiscordGo β Discord API wrapper
- OpenAI API
- Environment variables for secure key management
git clone https://github.com/yourname/discord-go-chatbot.git
cd discord-go-chatbot
setx DISCORD_BOT_TOKEN "your-bot-token"
setx OPENAI_API_KEY "your-openai-key"
Restart your terminal after setting them.
go run main.go
/discord-bot
βββ main.go
βββ go.mod
βββ README.md
| Command | Description |
|---|---|
!ping |
Check if the bot is alive |
!hello |
Simple greeting |
!ask <question> |
Ask the AI anything |
Contributions, issues, and feature requests are welcome. Feel free to submit a PR!
This project is licensed under the MIT License.