Skip to content

Commit 1ca9562

Browse files
committed
Update: Minor fixes
1 parent fd2e003 commit 1ca9562

4 files changed

Lines changed: 27 additions & 4 deletions

File tree

docs/TEST_WORKFLOW_CHECKLIST.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,20 @@ Any other user must get "Access denied" or "not authorized" on the above.
183183
7. **PermissionManager:** As admin: `/status` → status message; as non-admin: `/status` → access denied.
184184

185185
If all items in the quick smoke sequence pass, the core workflow (startup, Validator, PermissionManager, admin panel including Products/Webhooks/Health, help, usage period) is working as intended.
186+
187+
---
188+
189+
## Implementation alignment
190+
191+
The TG-Bot codebase is aligned with this checklist for the LicenseChain ecosystem:
192+
193+
- **Startup (§1):** `TELEGRAM_TOKEN` required (exit); `LICENSE_CHAIN_API_KEY` warning when missing.
194+
- **General (§2):** `/start` shows welcome + inline buttons (Validate, Analytics, Profile, Settings, Help); `/help` and `/help <command>` with command-specific help and "Command not found. Use /help to see all available commands." for unknown commands; `/profile` (with optional linked-account tier/role); `/settings`, `/license`, `/list`, `/analytics`, `/usage [7d|30d|90d|1y|all]` with invalid-period error; `/info`.
195+
- **Validate (§3):** Validator on key; usage when no key; invalid key format/length; plain-text license key handled by MessageHandler.
196+
- **Admin (§4):** Non-admin gets "not authorized" or "Access denied. Administrators only." on admin-only commands; admin panel includes Statistics, Users, Licenses, Products, Webhooks, Health, System, Logs, **Settings** (configure via ADMIN_USERS, BOT_OWNER_ID); callbacks for each; create/extend/revoke/update with Validator and usage messages.
197+
- **Tickets (§5):** `/tickets`, create, view own/admin, close (admin).
198+
- **Callbacks (§6):** Start buttons, validate, profile, settings, analytics, help; admin panel callbacks; settings toggles and language.
199+
- **PermissionManager (§7):** All admin actions gated by `ADMIN_USERS` / `BOT_OWNER_ID`.
200+
- **Validator (§8):** License key, email, integer (min 1), period (7d, 30d, 90d, 1y; usage also supports `all`).
201+
202+
When changing behavior, update this checklist and the code together so they stay in sync.

src/commands/admin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class AdminCommand {
3535
[
3636
{ text: '🔧 System', callback_data: 'admin:system' },
3737
{ text: '📝 Logs', callback_data: 'admin:logs' }
38+
],
39+
[
40+
{ text: '⚙️ Settings', callback_data: 'admin:settings' }
3841
]
3942
]
4043
};
@@ -306,6 +309,9 @@ module.exports = {
306309
[
307310
{ text: '🔧 System', callback_data: 'admin:system' },
308311
{ text: '📝 Logs', callback_data: 'admin:logs' }
312+
],
313+
[
314+
{ text: '⚙️ Settings', callback_data: 'admin:settings' }
309315
]
310316
]
311317
};

src/handlers/CommandHandler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ class CommandHandler {
9797
await this.bot.sendMessage(msg.chat.id, '❌ An error occurred while processing your command.');
9898
}
9999
} else {
100-
// Command not found
100+
// Command not found (aligned with TEST_WORKFLOW_CHECKLIST.md §2.5)
101101
await this.bot.sendMessage(msg.chat.id,
102-
`❌ Unknown command: /${commandName}\n\n` +
103-
`Type /help to see all available commands.`
102+
'Command not found. Use /help to see all available commands.',
103+
{ parse_mode: 'Markdown' }
104104
);
105105
}
106106
}

src/handlers/MessageHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class MessageHandler {
642642
await adminCommand.handleLogs(ctx);
643643
break;
644644
case 'settings':
645-
await ctx.reply('Admin settings: configure via environment variables (ADMIN_USERS, BOT_OWNER_ID).');
645+
await ctx.reply('Admin settings: configure via ADMIN_USERS and BOT_OWNER_ID in your environment.');
646646
break;
647647
default:
648648
await ctx.reply('Unknown admin action.');

0 commit comments

Comments
 (0)