Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Discord Bot Playground πŸ€–

A simple yet feature-rich Discord bot written in Go (Golang) using the DiscordGo library.

Features ✨

  • πŸ“ 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

Quick Start πŸš€

Prerequisites

  • Go 1.21 or higher installed
  • A Discord account and server
  • A Discord bot token (see SETUP.md for detailed instructions)

Installation

  1. Clone the repository

    git clone https://github.com/riyanimam/discord-bot-playground.git
    cd discord-bot-playground
  2. Set up environment variables

    cp .env.example .env
    # Edit .env and add your Discord bot token
  3. Install dependencies

    go mod download
  4. Run the bot

    export $(cat .env | xargs) && go run main.go

Detailed Setup Instructions πŸ“–

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.

Commands πŸ’¬

All commands use the ! prefix by default (configurable):

Basic Commands

Command Description
!ping Check the bot's latency and responsiveness
!help Display all available commands with descriptions
!info Show information about the bot

Server & User Information

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

Fun Commands

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

Utility Commands

Command Description
!poll <question> | <option1> | <option2> | ... Create a poll with up to 10 options. The bot will add number reactions for voting

Command Examples

!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

Project Structure πŸ“

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

Configuration βš™οΈ

The bot uses environment variables for configuration:

  • DISCORD_BOT_TOKEN - Your Discord bot token (required)
  • BOT_PREFIX - Command prefix (optional, defaults to !)

Development πŸ› οΈ

Building

go build -o discord-bot

Running Tests

go test ./...

Code Structure

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

Tech Stack πŸ’»

  • Language: Go (Golang) 1.21+
  • Discord Library: DiscordGo v0.27.1
  • Architecture: Event-driven bot with message handlers

Contributing 🀝

Contributions are welcome! Feel free to:

  • Add new commands
  • Improve existing features
  • Fix bugs
  • Enhance documentation

Security πŸ”’

  • Never commit your .env file
  • Keep your bot token secret
  • The .env file is already in .gitignore
  • Regenerate your token if it's ever exposed

License πŸ“„

This project is open source and available under the MIT License.

Resources πŸ“š

Support πŸ’¬

If you need help:

  1. Check SETUP.md for detailed instructions
  2. Review the troubleshooting section
  3. Open an issue on GitHub

Made with ❀️ using Go

About

πŸ€– A simple and extensible Discord bot written in Go (Golang) using the DiscordGo library. It includes essential commands like !ping, !help, !info, and utilities to fetch server and user info β€” perfect as a starter project or playground for experimenting with Discord bot development in Go.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages