onMyChatMember(JoinedChatHandler::class); // HandlerGroup::middleware() unshifts — register GroupAdminOnly first so // AuthorizedChat ends up outermost (chat allowlist before admin check). $bot->group(function (Nutgram $bot) { $bot->onCommand('help', HelpCommand::class) ->description('List available commands'); $bot->onCommand('ping', PingCommand::class) ->description('Health check'); $bot->onCommand('data', DataCommand::class) ->description('Visit stats (today). Optional: /data 1|7|30 [channelId]'); $bot->onCommand('data {args}', DataCommand::class) ->where('args', '.+') ->description('Visit stats for 1/7/30 days, optional channelId'); $bot->onCommand('channel', ChannelCommand::class) ->description('List channels; copy promo iframe (new) or support link (old)'); $bot->onCommand('transfer {args}', TransferCommand::class) ->where('args', '.+') ->description('Transfer TRX or USDT from a device address (omit amount = all)'); }) ->middleware(GroupAdminOnly::class) ->middleware(AuthorizedChat::class); } }