Skip to content

Contributing

Thank you for your interest in contributing to Alita Robot! This guide will help you get started with development.

  • Go 1.25+
  • PostgreSQL 14+
  • Redis 6+
  • Make (for running commands)
Terminal window
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
cp sample.env .env
# Edit .env with your configuration
Terminal window
make run # Run the bot locally
make build # Build release artifacts using goreleaser
make lint # Run golangci-lint for code quality checks
make tidy # Clean up and download go.mod dependencies
Terminal window
make psql-migrate # Apply all pending PostgreSQL migrations
make psql-status # Check current migration status
make psql-reset # Reset database (DANGEROUS: drops all tables)
Alita_Robot/
├── alita/
│ ├── config/ # Configuration and environment parsing
│ ├── db/ # Database operations and repositories
│ ├── i18n/ # Internationalization
│ ├── modules/ # Command handlers (one file per module)
│ └── utils/ # Utility functions and decorators
├── locales/ # Translation files (YAML)
├── migrations/ # SQL migration files
└── main.go # Entry point
  1. Create database operations in alita/db/{module}_db.go
  2. Implement command handlers in alita/modules/{module}.go
  3. Register commands in the module’s init() function
  4. Add translations to locales/en.yml (and other locale files)
package modules
import (
"github.com/divkix/Alita_Robot/alita/utils/helpers"
"github.com/PaulSonOfLars/gotgbot/v2"
"github.com/PaulSonOfLars/gotgbot/v2/ext"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers"
)
var myModule = moduleStruct{moduleName: "mymodule"}
func (m moduleStruct) myCommand(b *gotgbot.Bot, ctx *ext.Context) error {
// Implementation
return ext.EndGroups
}
func init() {
helpers.RegisterModule(myModule.moduleName, func(d *ext.Dispatcher) {
d.AddHandler(handlers.NewCommand("mycommand", myModule.myCommand))
})
}
  • Run make lint before committing
  • Follow Go conventions and idioms
  • Use the repository pattern for data access
  • Add proper error handling with panic recovery
  • Use decorators for common middleware (permissions, error handling)

Add help messages to locales/en.yml:

mymodule_help_msg: |
Help text for my module.
*Commands:*
× /mycommand: Description of command.

The project uses golangci-lint for code quality. Manual testing is done with a test bot and group:

  1. Create a test bot via @BotFather
  2. Create a test group
  3. Configure your .env with the test bot token
  4. Run make run and test your changes
  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Make your changes
  4. Run make lint to check for issues
  5. Commit with a descriptive message
  6. Push to your fork
  7. Open a Pull Request