dbots/internal/bot/input.go
2026-04-17 22:05:05 +02:00

30 lines
867 B
Go

package bot
import (
"net/http"
"strconv"
"codeberg.org/nextgo/dbots/internal/db"
"codeberg.org/nextgo/dbots/internal/errorutil"
)
type CreateBotRequest struct {
ID string `json:"id"`
Username string `json:"username"`
Avatar string `json:"avatar"`
Overview string `json:"overview"`
Description string `json:"description"`
IsSlash bool `json:"is_slash"`
InstallContext db.InstallContext `json:"install_context"`
Prefix *string `json:"prefix"`
ImportedFrom *string `json:"imported_from"`
CoOwners []string `json:"co_owners"`
}
func (c *CreateBotRequest) Bind(req *http.Request) error {
if _, err := strconv.ParseUint(c.ID, 10, 64); err != nil {
return errorutil.ErrInvalidID
}
return nil
}