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:
21
pkg/bot/source.go
Normal file
21
pkg/bot/source.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user