feat(17-03): implement Telegram bot command handlers

- Add telego v1.8.0 dependency for Telegram Bot API
- Create pkg/bot package with Bot struct holding engine, verifier, recon, storage, registry deps
- Implement 8 command handlers: /help, /scan, /verify, /recon, /status, /stats, /providers, /key
- /key enforced private-chat-only for security (never exposes unmasked keys in groups)
- All other commands use masked keys only
- Handler registration via telego's BotHandler with CommandEqual predicates
This commit is contained in:
salvacybersec
2026-04-06 17:34:44 +03:00
parent 0e87618e32
commit 9ad58534fc
5 changed files with 588 additions and 0 deletions

21
pkg/bot/source.go Normal file
View File

@@ -0,0 +1,21 @@
package bot
import (
"fmt"
"os"
"github.com/salvacybersec/keyhunter/pkg/engine/sources"
)
// selectBotSource returns the appropriate Source for a bot scan request.
// Only file and directory paths are supported (no git, stdin, clipboard, URL).
func selectBotSource(path string) (sources.Source, error) {
info, err := os.Stat(path)
if err != nil {
return nil, fmt.Errorf("stat %q: %w", path, err)
}
if info.IsDir() {
return sources.NewDirSource(path), nil
}
return sources.NewFileSource(path), nil
}