Contributing
Thank you for your interest in contributing to Solstice! This guide covers everything you need to know to make high-quality contributions.
Getting Started
- Fork the repository on GitHub
- Clone your fork locally:bash
git clone https://github.com/YOUR_USERNAME/SolsticeIO.git cd SolsticeIO - Create a branch for your work:bash
git checkout -b feature/my-feature - Set up the development environment - follow Getting Started
Project Architecture
Before contributing, read the Architecture document to understand the pure Go architecture. Key points:
- Go handles everything: Bot API interactions, database, queue, and voice streaming via CGo
libntgcalls - Embedded Web Server hosts the WebSocket hub and Web Room
- All voice streaming runs in-process with zero external daemons
- All state is in MongoDB; all stream caching in Upstash Redis
Code Organization
Go Code (internal/)
| Directory | Convention |
|---|---|
telegram/ | One file per feature module (admins.go, fun.go, tools.go, etc.) |
database/ | All DB functions in a single file (db.go) - package-level functions |
config/ | Single file, singleton pattern |
queue/ | Single file, mutex-protected struct |
youtube/ | One file per concern (search, extraction, cache, proxy) |
Adding a New Command
- Create the handler function in the appropriate file:go
func (h *BotHandler) handleMyCommand(c telebot.Context) error { // Your logic here return c.Reply("Response") } - Register it in the corresponding
Init*()function:gofunc (h *BotHandler) InitTools() { // ... existing handlers h.Bot.Handle("/mycommand", h.handleMyCommand) } - Add help text to
strings/langs/en.yml - Update the help menu in
help.goif applicable
Adding a New Language String
- Add the key to
strings/langs/en.yml:yamlmy_key: "Hello {0}, welcome to {1}!" - Use it in code:go
text := i18n.GetString("my_key", userName, chatName)
Code Style
Go
- Follow standard
gofmtformatting - Use descriptive function names (
handleBan, nothBan) - Keep sassy bot personality in user-facing strings
- Use
h.logError()for all error logging - Always check
h.CheckAdminSassy(c)for admin commands - Use
h.getTargetUser(c)for resolving target users
Commit Messages
Write natural, direct commit messages like a human developer (never use conventional prefixes like feat:, fix:, or chore:):
Add dice command with random roll
Resolve race condition in queue shuffle
Update command reference with new flags
Extract proxy pool into separate packagePull Request Process
- Ensure your code builds:
go build ./... - Test your changes manually with a bot instance
- Update documentation if you added/changed commands
- Push to your fork and open a PR against
dev(never targetmain) - Describe what your PR does and why
PR Title Format
Brief description of the feature or bug fixDevelopment Tips
Running in Development Mode
Set DEVELOPER_MODE=true in .env for verbose logging.
Testing Without Voice Chat
You can test all non-VC commands without configuring an assistant session string. The bot will still respond to admin, fun, utility, and management commands.
Useful Commands During Development
bash
# Build and run in one step
go run cmd/bot/main.go
# Check for compilation errors without building
go vet ./...
# Format all Go files
gofmt -w .
# Update Go dependencies
go mod tidyReporting Issues
When reporting bugs, include:
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Error logs (from the logger channel or console)
- Environment (OS, Go version)
License
By contributing to Solstice, you agree that your contributions will be licensed under the GNU General Public License v3.0.
