A simple yet feature-rich Discord bot written in Go (Golang) using the DiscordGo library.
- π Ping command - Check bot latency
- π Help command - Interactive help menu
- βΉοΈ Info command - Bot information
- π° Server info - Display server details
- π€ User info - Show user information
- πΌοΈ Avatar command - Display user avatars in full resolution
- π± Magic 8-Ball - Ask questions and get mystical answers
- π² Dice roller - Roll dice with standard notation (e.g., 2d6, 1d20)
- πͺ Coin flip - Flip a coin for quick decisions
- π Poll creator - Create interactive polls with emoji reactions
- π¨ Rich embeds - Beautiful embedded messages
- β‘ Fast and efficient - Written in Go
- π§ Easy to configure - Simple environment variable setup
- Go 1.21 or higher installed
- A Discord account and server
- A Discord bot token (see SETUP.md for detailed instructions)
-
Clone the repository
git clone https://github.com/riyanimam/discord-bot-playground.git cd discord-bot-playground -
Set up environment variables
cp .env.example .env # Edit .env and add your Discord bot token -
Install dependencies
go mod download
-
Run the bot
export $(cat .env | xargs) && go run main.go
For complete setup instructions including:
- Creating a Discord application
- Getting your bot token
- Inviting the bot to your server
- Running in production
- Troubleshooting
Please see SETUP.md for the full guide.
All commands use the ! prefix by default (configurable):
| Command | Description |
|---|---|
!ping |
Check the bot's latency and responsiveness |
!help |
Display all available commands with descriptions |
!info |
Show information about the bot |
| Command | Description |
|---|---|
!server |
Display information about the current server |
!userinfo [@user] |
Show information about yourself or a mentioned user |
!avatar [@user] |
Display user's avatar in full resolution with download link |
| Command | Description |
|---|---|
!8ball <question> |
Ask the magic 8-ball a question and get a mystical answer |
!roll [dice notation] |
Roll dice using standard notation (e.g., !roll 2d6, !roll 1d20) |
!coinflip or !flip |
Flip a coin - heads or tails |
| Command | Description |
|---|---|
!poll <question> | <option1> | <option2> | ... |
Create a poll with up to 10 options. The bot will add number reactions for voting |
!8ball Will I win the game?
!roll 2d6
!roll 1d20
!coinflip
!avatar @username
!poll What should we do? | Play games | Watch a movie | Go outside
discord-bot-playground/
βββ main.go # Main bot application
βββ go.mod # Go module dependencies
βββ go.sum # Go module checksums
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ SETUP.md # Detailed setup guide
The bot uses environment variables for configuration:
DISCORD_BOT_TOKEN- Your Discord bot token (required)BOT_PREFIX- Command prefix (optional, defaults to!)
go build -o discord-botgo test ./...The bot is organized with:
- Event handlers - Handle Discord events (messages, ready state)
- Command handlers - Process individual commands
- Embedded responses - Rich Discord embeds for better UX
- Language: Go (Golang) 1.21+
- Discord Library: DiscordGo v0.27.1
- Architecture: Event-driven bot with message handlers
Contributions are welcome! Feel free to:
- Add new commands
- Improve existing features
- Fix bugs
- Enhance documentation
- Never commit your
.envfile - Keep your bot token secret
- The
.envfile is already in.gitignore - Regenerate your token if it's ever exposed
This project is open source and available under the MIT License.
If you need help:
- Check SETUP.md for detailed instructions
- Review the troubleshooting section
- Open an issue on GitHub
Made with β€οΈ using Go