mirror of
https://github.com/HugeFrog24/go-telegram-bot.git
synced 2026-03-02 00:14:34 +00:00
MVP
md formatting doesnt work yet Started implementing owner feature Add .gitattributes to enforce LF line endings Temporary commit before merge Updated owner management Updated json and gitignore Proceed with role management Again, CI Fix some lint errors Implemented screening Per-bot API keys implemented Use getRoleByName func Fix unused imports Upgrade actions rm unused function Upgrade action Fix unaddressed errors
This commit is contained in:
9
config.go
Executable file → Normal file
9
config.go
Executable file → Normal file
@@ -18,6 +18,9 @@ type BotConfig struct {
|
||||
TempBanDuration string `json:"temp_ban_duration"`
|
||||
Model anthropic.Model `json:"model"` // Changed from string to anthropic.Model
|
||||
SystemPrompts map[string]string `json:"system_prompts"`
|
||||
Active bool `json:"active"` // New field to control bot activity
|
||||
OwnerTelegramID int64 `json:"owner_telegram_id"`
|
||||
AnthropicAPIKey string `json:"anthropic_api_key"` // Add this line
|
||||
}
|
||||
|
||||
// Custom unmarshalling to handle anthropic.Model
|
||||
@@ -56,6 +59,12 @@ func loadAllConfigs(dir string) ([]BotConfig, error) {
|
||||
return nil, fmt.Errorf("failed to load config %s: %w", configPath, err)
|
||||
}
|
||||
|
||||
// Skip inactive bots
|
||||
if !config.Active {
|
||||
fmt.Printf("Skipping inactive bot: %s\n", config.ID)
|
||||
continue
|
||||
}
|
||||
|
||||
// Validate that ID is present
|
||||
if config.ID == "" {
|
||||
return nil, fmt.Errorf("config %s is missing 'id' field", configPath)
|
||||
|
||||
Reference in New Issue
Block a user