first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { isOperator } from '../middlewares/business.js';
|
||||
|
||||
export default {
|
||||
command: 'help',
|
||||
aliases: ['помощь', 'справка'],
|
||||
description: 'Список команд',
|
||||
scope: 'all',
|
||||
|
||||
async handler(ctx, args, { registry }) {
|
||||
const operator = isOperator(ctx);
|
||||
|
||||
// Админские команды показываем только тем, кто может их вызвать.
|
||||
const available = registry.visible().filter((cmd) => operator || !cmd.adminOnly);
|
||||
|
||||
const lines = available.map((cmd) => {
|
||||
const aliases = cmd.aliases.length ? ` (${cmd.aliases.map((a) => `/${a}`).join(', ')})` : '';
|
||||
const mark = cmd.adminOnly ? ' 🔒' : '';
|
||||
return `/${cmd.command}${aliases} — ${cmd.description}${mark}`;
|
||||
});
|
||||
|
||||
await ctx.reply(lines.length ? `Команды:\n${lines.join('\n')}` : 'Команд пока нет.');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user