feat: per-category greeting menu in bot config
Add a "Por Categoría" tab in the bot config UI where each permission category (1, 2, 3) can be assigned its own greeting button menu. When a user writes without an active context, the bot shows the menu configured for their category instead of falling through to the global greeting text. NormalBot.process() now checks per_type[X].greeting_menu first, which directly references a menu key and serves as both greeting and fallback for that category. Fully backward-compatible with existing greeting_flow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
0b851208ea
commit
32e2a2a82e
@@ -410,6 +410,21 @@ $routes = [
|
||||
$aiProvider = trim($_POST['ai_provider'] ?? '');
|
||||
if ($aiProvider !== '') $config['ai_provider'] = $aiProvider;
|
||||
|
||||
// Per-category menus
|
||||
$perTypeMenus = $_POST['per_type_menu'] ?? [];
|
||||
$perType = [];
|
||||
foreach ([1, 2, 3] as $cat) {
|
||||
$mk = trim($perTypeMenus[$cat] ?? '');
|
||||
if ($mk !== '') {
|
||||
$perType[(string)$cat] = [
|
||||
'greeting_menu' => $mk,
|
||||
'greeting' => '',
|
||||
'fallback' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
if (!empty($perType)) $config['per_type'] = $perType;
|
||||
|
||||
// General
|
||||
$greeting = trim($_POST['greeting'] ?? '');
|
||||
if ($greeting !== '') $config['greeting'] = $greeting;
|
||||
|
||||
Reference in New Issue
Block a user